ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Codes to combine PDF files (https://www.excelbanter.com/excel-programming/388605-vba-codes-combine-pdf-files.html)

salut

VBA Codes to combine PDF files
 
I had a VBA Code to combine PDF files. It works file with my Adobe Acrobat
7.0. But recently I installed an Acrobat 8.0 reader, and then found out that
the code doesn't function properly. Then I uninstalled it. My code still
doesn't work.

This is the part of the code that doesn't work:

Dim objPDFDoc As Object
Set objPDFDoc = New AcroPDDoc

Now everytime the program goes to the "Set objPDFDoc = New AcroPDDoc". It
automatically exit the procedure.

Could anybody help me to figure out what is the reason and how to solve the
problem? Thanks a lot!

NickHK

VBA Codes to combine PDF files
 
As it appears you are using late-binding, that should be

Dim objPDFDoc As Object
Set objPDFDoc = createObject("<AcrobatLib.AcroPDDoc")

Change <AcrobatLib to the correct libarary.

Otherwise use early-binding (ToolsReferences) and
Dim objPDFDoc As <AcrobatLib.AcroPDDoc
set objPDFDoc = New<AcrobatLib.AcroPDDoc

Previous versions (6 and below ?) of the Reader were not available to
automation. Can't say about v8.

NickHK

"salut" wrote in message
...
I had a VBA Code to combine PDF files. It works file with my Adobe Acrobat
7.0. But recently I installed an Acrobat 8.0 reader, and then found out

that
the code doesn't function properly. Then I uninstalled it. My code still
doesn't work.

This is the part of the code that doesn't work:

Dim objPDFDoc As Object
Set objPDFDoc = New AcroPDDoc

Now everytime the program goes to the "Set objPDFDoc = New AcroPDDoc". It
automatically exit the procedure.

Could anybody help me to figure out what is the reason and how to solve

the
problem? Thanks a lot!




salut

VBA Codes to combine PDF files
 
Thanks a lot for your reply!

I got my acrobat 7.0 reinstalled, and tried both late-binding approach and
early-binding approach. Neither of them worked.

Looks like this might be the problem.

When I search AcroPDDoc by pressing F2. it shows that it belows to Acrobat.
But apparently My VBA code doesn't recognize the name "Acrobat" very well
because it doesn't change the cases of letters. I can type in
"aCRObat.AcroPDDoc" and it is not going to change it. But I can't say if it
is loaded in my reference library or not. Because when I type "aCRObat." the
VBA Editor will show me a dropdown box from which I can select AcroPDDoc.

I am totally confused by the situation. Whatever I try, it always jump out
of the subrutine directly at the "Set objPDFDoc = New AcroPDDoc" statement.

"NickHK" wrote:

As it appears you are using late-binding, that should be

Dim objPDFDoc As Object
Set objPDFDoc = createObject("<AcrobatLib.AcroPDDoc")

Change <AcrobatLib to the correct libarary.

Otherwise use early-binding (ToolsReferences) and
Dim objPDFDoc As <AcrobatLib.AcroPDDoc
set objPDFDoc = New<AcrobatLib.AcroPDDoc

Previous versions (6 and below ?) of the Reader were not available to
automation. Can't say about v8.

NickHK

"salut" wrote in message
...
I had a VBA Code to combine PDF files. It works file with my Adobe Acrobat
7.0. But recently I installed an Acrobat 8.0 reader, and then found out

that
the code doesn't function properly. Then I uninstalled it. My code still
doesn't work.

This is the part of the code that doesn't work:

Dim objPDFDoc As Object
Set objPDFDoc = New AcroPDDoc

Now everytime the program goes to the "Set objPDFDoc = New AcroPDDoc". It
automatically exit the procedure.

Could anybody help me to figure out what is the reason and how to solve

the
problem? Thanks a lot!






All times are GMT +1. The time now is 03:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com