MS Access VBA: Error in loading DLL
I have Acrobat 9 Standard, and the corresponding SDK. I'm working on an older MS Access 2003 program using VBA. I want to programatically combine 3 PDFs into 1. I have gleaned examples and advice from various forums to create the code. The code compiles with no errors, but when it's run, I get that old error: "Error in loading DLL."
The Reference is: Adobe Acrobat 9.0 Type Library
The path listed is: C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.dll
And the file is there.
When choosing the Reference, I check just plain "Acrobat", which Access switches to the above file. That file is not listed separately among the numerous Adobe and Acrobat DLL References available. I tried choosing other DLLs in place of "Acrobat", but they will not compile. So, Access recognizes that DLL, and finds the objects used in the code, compiling it without error.
Dim pdfOrigDoc As Object
Dim pdfNewDoc As Object
Set pdfOrigDoc = CreateObject("AcroExch.PDDoc")
Set pdfNewDoc = CreateObject("AcroExch.PDDoc")
The code will run through and past those lines without error, but errors when it tries to use those objects.
(The array is populated with 3 PDF files and paths.)
If pdfNewDoc.Open(arr_varFromPath(FP_PDF, LBound(arr_varFromPath, 2))) = True Then
If, instead of using late binding, I use early binding,
Dim pdfOrigDoc As Acrobat.CAcroPDDoc
Dim pdfNewDoc As Acrobat.CAcroPDDoc
I get "Error in loading DLL" on the Set statements. I tried variations using 'New Acrobat.CAcroPDDoc', but it definitely didn't like those. It seems odd that the Dim statement uses 'Acrobat.CAcroPDDoc', but the Set statement uses 'AcroExch.PDDoc'.
What's the problem? Why does it recognize it when compiling, but not when running? It's a fairly simple little procedure. What am I doing wrong?
