I am able to run the following code where I have Acrobat Reader 2017 installed as well as Adobe Acrobat XI Pro and Distiller XI.
I have another computer without XI Pro or Distiller.
First issue when I open my Excel sheet I get
Compile Error in hidden module: xxxxx
Second issue is in references I have
MISSING: Adobe Acrobat 10.0 Type Library
I uncheck it and run again, then I get errors on Set acroDoc = New AcroPDDoc
I note that I have the "ACROBAT" Ribbon in my working Excel, in my non-working Excel I do not.
Dim acroExchangeApp As Object
Set app = CreateObject("Acroexch.app")
Dim filePaths As Collection 'Paths for PDFS to append
Set filePaths = New Collection
Dim fileRows As Collection 'Row numbers PDFs to append
Set fileRows = New Collection
Dim sourceDoc As Object
Dim primaryDoc As Object ' PrimaryDoc is what we append too
Dim insertPoint As Long ' PDFs will be appended after this page in the primary Doc
Dim startPage As Long ' First desired page of appended PDF
Dim endPage As Long ' Last desired page of appended PDF
Dim colIndex As Long '
Dim numPages As Long
Dim acroDoc As Object
Set acroDoc = New AcroPDDoc
Set primaryDoc = CreateObject("AcroExch.PDDoc")
OK = primaryDoc.Open(filePaths(1))
Debug.Print "PRIMARY DOC OPENED & PDDOC SET: " & OK
For colIndex = 2 To filePaths.count
query_start_time = time()
start_memory = GetWorkingMemoryUsage
numPages = primaryDoc.GetNumPages() - 1
Set sourceDoc = CreateObject("AcroExch.PDDoc")
OK = sourceDoc.Open(filePaths(colIndex))
Debug.Print "(" & colIndex & ") SOURCE DOC OPENED & PDDOC SET: " & OK
numberOfPagesToInsert = sourceDoc.GetNumPages
'inserts pages
acroDoc.Open source_file_name
insertPoint = acroDoc.GetNumPages - 1
If endPage > 1 Then
OK = primaryDoc.InsertPages(insertPoint, sourceDoc, startPage, endPage - startPage, False)
Debug.Print "(" & colIndex & ") " & endPage - startPage & " PAGES INSERTED SUCCESSFULLY: " & OK
Else
OK = primaryDoc.InsertPages(insertPoint, sourceDoc, startPage, endPage - startPage + 1, False)
Debug.Print "(" & colIndex & ") " & endPage - startPage + 1 & " PAGES INSERTED SUCCESSFULLY: " & OK
End If
Set sourceDoc = Nothing
Next colIndex
OK = primaryDoc.Save(PDSaveFull, filePaths(1))
Debug.Print "PRIMARYDOC SAVED PROPERLY: " & OK
Set primaryDoc = Nothing
app.Exit
Set app = Nothing
Latest change:
First I get
Compile error, Cant find project or library
So then I uncheck "MISSING: Adobe Acrobat 10.0 Type Library" which dissolves this error,
Now get the following error, after I did this change:
Set acroDoc = New AcroPDDoc to Set acroDoc = CreateObject("AcroExch.PDDoc")
and now getting an error on the new line like so,




AcroExch.PDDocis part of Acrobat (but is not available in Reader). The classes you reference and try to create object of it are located in that files of Acrobat. So it is not problem of binding type, it doesn't work because such types are not registered on that another computer. So if the question is how to solve the errors: install Adobe Reader on that computer as well. - Daniel DušekMISSING, which is expected. You simply can't create object from type, which is not registered on that another computer, that's it. - Daniel Dušek