Click here to Skip to main content
15,881,763 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Adobe Acrobot and its working fine. but I want to merge PDF reports through free software and I am also using PDF merge And Split but I am unable to add its liberary reference in vba. Below is code

VB
Dim outputFileName As String

   Dim rs As DAO.Recordset
   
Set rs = CurrentDb.OpenRecordset("SELECT * From ItemCommissionDefinitionGroupBy  WHERE Delete = True")

'Dim Document As Acrobat.CAcroPDDoc
 Dim avDoc As Acrobat.CAcroPDDoc
Dim x, y  As Integer

'Set Document = CreateObject("AcroExch.PDDoc")

x = 1
rs.MoveLast
rs.MoveFirst

EmpNo = ""

y = rs.RecordCount

   Do While x <= y
       EmpNo = rs(0)
       Forms!CommisionCalculator!qryEmployee!Text178.value = EmpNo
       outputFileName = CurrentProject.path & "\tempReportFolder" & "\" & x & ".pdf"
       DoCmd.OutputTo acOutputReport, "EmployeeCommission", acFormatPDF, outputFileName, False
       DoCmd.Close acReport, "EmployeeCommission", acSaveNo
       'DoCmd.OpenReport "EmployeeCommission", acViewPreview
       
        'Call WinClose(outputFileName)
      x = x + 1
      rs.MoveNext
   Loop
   
'DoCmd.OpenReport "Report", acViewPreview
'Dim adbApp As Acrobat.AcroApp
Dim strPdfFile As String
Dim PDF
strPdfFile = "C:Users\BIlawalKhan\Desktop\[CommApp  5.3.15]\tempReportFolder\1.PDF|C:\Users\BIlawalKhan\Desktop\[CommApp  5.3.15]\tempReportFolder\2.PDF|C:\Users\BIlawalKhan\Desktop\[CommApp  5.3.15]\tempReportFolder\3.PDF"
Set PDF = CreateObject("PDFSplitMerge.PDFSplitMerge.1")
PDF.Merge strPdfFile, "c:\Report3.PDF"
MsgBox "Success", vbInformation

'Merge them into a single PDF file
'Dim mergedDoc As PdfDocument = PdfDocument.Merge(doc1, doc2)



'Exit_Command30_Click:
    'Exit Sub

'Err_Command30_Click:
    'MsgBox Err.Description
    'Resume Exit_Command30_Click

Links for pdf Example
https://www.dropbox.com/s/hvx91fjsitls15v/Reportslink.txt?dl=0[^]
Posted
Updated 12-Mar-15 1:24am
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900