Click here to Skip to main content
14,668,412 members
Rate this:
Please Sign up or sign in to vote.
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

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

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
'DoCmd.OpenReport "Report", acViewPreview
'Dim adbApp As Acrobat.AcroApp
Dim strPdfFile As String
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 Sub

    'MsgBox Err.Description
    'Resume Exit_Command30_Click

Links for pdf Example[^]
Updated 12-Mar-15 1:24am

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100