MS Access VBA: Error in loading DLL

Community Beginner ,
Dec 26, 2017

Copy link to clipboard

Copied

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?

Correct answer by victorcamp | Community Beginner

Taking bits of information from other forum posts, my code now works!

  1. I uninstalled Acrobat Reader, since, having the full version of Acrobat, it seemed superfluous anyway
  2. I then did a Repair on my Acrobat 9 Standard.
  3. This time, when I chose the Acrobat.tlb in the Access References window, it remained pointing to the TLB, and correctly identified itself as Acrobat 9.0 Type Library.

A little of this, a little of that, and the problem was solved.  But isn't that always the way with programming?

TOPICS
Acrobat SDK and JavaScript

Views

1.5K

Likes

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

MS Access VBA: Error in loading DLL

Community Beginner ,
Dec 26, 2017

Copy link to clipboard

Copied

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?

Correct answer by victorcamp | Community Beginner

Taking bits of information from other forum posts, my code now works!

  1. I uninstalled Acrobat Reader, since, having the full version of Acrobat, it seemed superfluous anyway
  2. I then did a Repair on my Acrobat 9 Standard.
  3. This time, when I chose the Acrobat.tlb in the Access References window, it remained pointing to the TLB, and correctly identified itself as Acrobat 9.0 Type Library.

A little of this, a little of that, and the problem was solved.  But isn't that always the way with programming?

TOPICS
Acrobat SDK and JavaScript

Views

1.5K

Likes

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
Dec 26, 2017 0
Adobe Employee ,
Dec 27, 2017

Copy link to clipboard

Copied

First off, we no longer support Acrobat 9.

Second, if you look at the path, you will clearly see that it is pointing to READER 11 and not Acrobat 9. Reader doesn’t support combining.

Likes

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
Reply
Loading...
Dec 27, 2017 0
Community Beginner ,
Dec 27, 2017

Copy link to clipboard

Copied

I noticed the path, yes, but that's the one that Access chose.  If Access went looking for the appropriate DLL, it shouldn't matter where it found it.  If that's not the right DLL, then what is the right DLL?  There are dozens of various DLLs in several Acrobat directories.  With a full version of Acrobat, I would assume I've got the right one somewhere.  Is there a listing of DLLs vs. Acrobat versions I can refer to?  Do you know the correct DLL I need to reference?

Likes

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
Reply
Loading...
Dec 27, 2017 0
Community Beginner ,
Dec 27, 2017

Copy link to clipboard

Copied

Taking bits of information from other forum posts, my code now works!

  1. I uninstalled Acrobat Reader, since, having the full version of Acrobat, it seemed superfluous anyway
  2. I then did a Repair on my Acrobat 9 Standard.
  3. This time, when I chose the Acrobat.tlb in the Access References window, it remained pointing to the TLB, and correctly identified itself as Acrobat 9.0 Type Library.

A little of this, a little of that, and the problem was solved.  But isn't that always the way with programming?

Likes

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
Reply
Loading...
Dec 27, 2017 0