Copy link to clipboard
Copied
I'm having trouble getting commands that relate to the Adobe Acrobat 10.0 Type Library to run in Excel VBA. In my code I'm just trying to open two PDFs and merge them into one.
I have Adobe Acrobat Pro (Version 23.001.20174.0) installed and I have Adobe Acrobat 10.0 Type Library enabled in my VBA editor. But when I run the program line by line the only command that seems to work is the Set Aapp = CreateObject("AcroExch.App"). Everything after that will "run" in Excel VBA but nothing actually happens.
Thanks for your help!
Q
Sub combine_pdf_files()
Dim Aapp As Acrobat.AcroApp
Dim toDoc As Acrobat.AcroPDDoc
Dim fromDoc As Acrobat.AcroPDDoc
Set Aapp = CreateObject("AcroExch.App")
Set toDoc = CreateObject("AcroExch.PDDoc")
Set fromDoc = CreateObject("AcroExch.PDDoc")
Aapp.Show
toDoc.Open ("S:\DRYLNE\DT Report - New\24 Hr Reports\Dryer Daily Report.pdf")
fromDoc.Open ("S:\DRYLNE\DT Report - New\24 Hr Reports\Blender Daily Report.pdf")
If toDoc.InsertPages(0, fromDoc, 0, fromDoc.GetNumPages(), True) = False Then
Debug.Print "Failed to insert the page"
End If
If toDoc.Save(PDSaveFull, "S:\DRYLNE\DT Report - New\24 Hr Reports\Dryline 24 Hour Report.pdf") = False Then
Debug.Print "Failed to save"
Else
Debug.Print "Dryline Report Saved"
End If
toDoc.Close
fromDoc.Close
Aapp.Exit
End Sub
Have something to add?