Opening Acrobat Reader using VBA

R

Raam

Though I have added the Acrobat Library under tools and references I get
an error ‘429’ which says “ActiveX component can’t create object”. Can
you please test this and see if you get to the bottom of this problem?


Sub Open_PDF()
Dim PDDoc As AcroPDDoc
Dim i As Long
Set PDDoc = CreateObject("AcroExch.PDDoc")
i = PDDoc.Open("d:\test.pdf")
End Sub
 
O

ODI

Some questions to clear up the situation:
1) Which Version of Acrobat are you using?
2) Do you only have Reader or also other Adobe Products on your PC?
3) Which Object Library did you reference?

This is not really an Excel problem, I would post it in Adobe Forums. Hier
is a link to try: http://forum.planetpdf.com/

Didem
 
O

ODI

Hi again!

If you just want to open the document, try this:

Sub Open_PDF()
Dim RetVal As Double
RetVal = Shell("C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe
D:\test.pdf", vbNormalFocus)
End Sub

Change the path of Acrobat and of the file you want to open. If you don't
know the path you can find it out in cmd-Window with two commands:

C:\>assoc .pdf
..pdf=AcroExch.Document
C:\>ftype AcroExch.Document
AcroExch.Document="C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe"
"%1"

Hope this helps!
Didem
 
S

smogerp

Hi, was having similar issues. I have a dynamic location where a document is
saved and then I want to open the document. I tried what you had below. But
when it tried to open it in Acrobat, I get an error in Acrobat "There was an
error opening this document. The file does not exist". I tried:

RetVal = Shell("C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
\\servername\AAAA-ABCDEFG20051114101850.pdf", vbNormalFocus)


And

sLocation = "\\servername\AAAA-ABCDEFG20051114101850.pdf"
RetVal = Shell("C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe " &
sLocation, vbNormalFocus)

Neither one worked. I can open the file from Acrobat by the File/Open
process. What I need to do is to open the file directly so users don't have
to go find the document.

Any suggestions?

Thanks in advance.

Phill

ODI said:
Hi again!

If you just want to open the document, try this:

Sub Open_PDF()
Dim RetVal As Double
RetVal = Shell("C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe
D:\test.pdf", vbNormalFocus)
End Sub

Change the path of Acrobat and of the file you want to open. If you don't
know the path you can find it out in cmd-Window with two commands:

C:\>assoc .pdf
.pdf=AcroExch.Document
C:\>ftype AcroExch.Document
AcroExch.Document="C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe"
"%1"

Hope this helps!
Didem
 
O

ODI

Hi!
File path should come immediately after the programm path:
"C:\Program Files\Adobe\Acrobat 6.0\Acrobat\Acrobat.exe D:\test.pdf"
Try it with a local path, if it works try with a static server path and then
a dynamic one to be able to localize the error source. I first had the same
error and I recognized that the path syntax was not right. If you use
variables, watch their values by debugging modus.

Another try could be to map the server drive instead of using \\servername.

Good night... (It's 10.30 pm hier!)

smogerp said:
Hi, was having similar issues. I have a dynamic location where a document is
saved and then I want to open the document. I tried what you had below. But
when it tried to open it in Acrobat, I get an error in Acrobat "There was an
error opening this document. The file does not exist". I tried:

RetVal = Shell("C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe
\\servername\AAAA-ABCDEFG20051114101850.pdf", vbNormalFocus)


And

sLocation = "\\servername\AAAA-ABCDEFG20051114101850.pdf"
RetVal = Shell("C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe " &
sLocation, vbNormalFocus)

Neither one worked. I can open the file from Acrobat by the File/Open
process. What I need to do is to open the file directly so users don't have
to go find the document.

Any suggestions?

Thanks in advance.

Phill
 

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