VBA Codes to combine PDF files

G

Guest

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!
 
N

NickHK

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 (Tools>References) 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
 
G

Guest

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.
 
Joined
Dec 2, 2009
Messages
1
Reaction score
0
Acrobat.AcroPDDoc.Open method causes excel to crash

I've been trying to work out why the following causes Excel to crash.

This is an simplified extract from a class library for merging pdfs
that was working reliably for ages.

I've not changed versions of acrobat since it stopped
working, so I'm flumoxed. Anyone got any ideas?

Set objAcroApp = CreateObject("AcroExch.App")
Set objAcroDoc = CreateObject("AcroExch.PDDoc")
Set objAcroDocSrc = CreateObject("AcroExch.PDDoc")

'The following line crashes excel

objAcroDoc.Open ("C:\temp\test1.pdf")

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top