• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Excel VBA

New Here ,
Apr 11, 2024 Apr 11, 2024

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

TOPICS
Edit and convert PDFs

Views

104

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation