Skip to main content
Participating Frequently
January 29, 2013
Question

VBA Code error with Adobe Acrobat 10 Type Library

  • January 29, 2013
  • 4 replies
  • 65359 views

Hi,

I have some code I created in Word VBA to combine several separate PDFs into a single PDF.  The code works fine with the Adobe Acrobat 9.0 Type Library and Adobe Reader 9.0 installed.

But, with the Adobe Acrobat 10 Type Library and Adobe Reader 10 installed, the code fails at the marked code below.  Any suggestions??

    Dim acrobatApp As Acrobat.acroApp

    Set acrobatApp = CreateObject("AcroExch.App")

    Dim mainPDF As Acrobat.AcroPDDoc

    Set mainPDF = CreateObject("AcroExch.PDDoc")  ****THIS IS WHERE THE CODE STOPS WITH A "TYPE MISMATCH" ERROR****

   

    Dim nextPage As Acrobat.AcroPDDoc

    Set nextPage = CreateObject("AcroExch.PDDoc")

       

    Dim numPages As Integer

   

    'Loop through all selected VLS, and add each one to the end of the main PDF

    For i = 0 To lstSelected.ListCount - 1

        mainPDF.Open CurDir & "\" & Replace(ThisDocument.Name, ".doc", "") & ".pdf"

        numPages = mainPDF.GetNumPages

        nextPage.Open lstSelected.List(i)

       

        If mainPDF.InsertPages(numPages - 1, nextPage, 0, nextPage.GetNumPages, True) = False Then

            MsgBox "Cannot insert pages"

        End If

       

        If mainPDF.Save(PDSaveFull, CurDir & "\" & Replace(ThisDocument.Name, ".doc", "") & ".pdf") = False Then

            MsgBox "Cannot save"

        End If

       

        'MsgBox lstSelected.List(i)

        nextPage.Close

    Next i

This topic has been closed for replies.

4 replies

Participant
August 19, 2017

I am having the same problem with Windows 10, VBA for Excel and Adobe InDesign CS6 and Illustrator CS6 Type library. Same errors Type mismatch trying to instantiate the application. and then errors setting the document as a child of the app. I lost a $4000 job because of this.

.

Bernd Alheit
Community Expert
Community Expert
August 19, 2017

You need Adobe Acrobat to combine PDF files.

Participant
February 4, 2013

I had the same error (429 ActiveX component can't create object) at the same line when trying to create the same object using 10 but not in 9. I then sat down at a computer with Adobe Pro Extended and the code works just fine.

Bernd Alheit
Community Expert
Community Expert
January 29, 2013

Is Adobe Acrobat installed on the system? Your code will not work with Adobe Reader.

bbulla1Author
Participating Frequently
January 29, 2013

Sorry....I meant to say Adobe Acrobat 9.

And 'Yes' this code works in 9 but not in 10.

Bernd Alheit
Community Expert
Community Expert
January 29, 2013

And you have Adobe Acrobat X ?

Karl Heinz  Kremer
Community Expert
Community Expert
January 29, 2013

I doubt that this ever worked with Reader 9. You are using an interface

that is only available when you have Adobe Acrobat installed. There are

some features in the IAC (Interapplication Communication) API, but it's

very limited. The documentation will tell you what's available what what's

not.

Karl Heinz Kremer

PDF Acrobatics Without a Net

khk@khk.net

http://www.khkonsulting.com