tinkythomas
Active Member
- Joined
- Dec 13, 2006
- Messages
- 432
I'm trying to open a pdf file from within excel vba. I have tried using the followhyperlink method but adobe acrobat opens very briefly then immediately closes
So then I tried to create an instance of acrobat by setting a reference to the acrobat object but I can't get this to work either!
The code I'm using is
Any ideas what could be wrong with either approach?
Thank-you
Code:
Sub OpenPDF()
'Dim pdf As String
On Error Resume Next
'pdf file to open
pdf = "K:\PDF\mypdf.pdf"
'open the pdf file
ActiveWorkbook.FollowHyperlink pdf
End Sub
The code I'm using is
Code:
Sub OpenPDF()
Dim pdf As AcroPDDoc
Dim strPDF As String
Set pdf = CreateObject("AcroExch.PDDoc")
'pdf file to open
strPDF = "K:\PDF\mypdf.pdf"
'open the pdf file
pdf.Open strPDF
End Sub
Thank-you