Hi all,
I have a pdf document in a specified path. I want to open that pdf document using VBA code. Please advise.
Thanks,
Senthil. S :)
Printable View
Hi all,
I have a pdf document in a specified path. I want to open that pdf document using VBA code. Please advise.
Thanks,
Senthil. S :)
Try this...
vb Code:
Sub OpenPDF() Dim AcroApp As CAcroApp, AVDoc As CAcroAVDoc Dim PDDoc As CAcroPDDoc, MyFilePath As String Dim mystring As String, MyPage As Long '~~> Change this to an existing pdf file on your system MyFilePath = "c:\Temp.pdf" Set AcroApp = CreateObject("AcroExch.App") Set AVDoc = CreateObject("AcroExch.AVDoc") AVDoc.Open MyFilePath, "" Set PDDoc = AVDoc.GetPDDoc '~~> Navigate to a specific page If IsNull(Me.Jumpto) Then MsgBox ("enter a page to jump to") Else: MyPage = Me.Jumpto - 1 AVDoc.GetAVPageView.GoTo MyPage AcroApp.Show End Sub
Dear Koolsid,
Thanks for your reply. To execute the code can you please mention what are the references i need to include.
Thanks,
Senthil. S :)