tselectro
asked on
Open PDF file and goto a specific page
Hello
From VBA in Excel 2007 I want to open a pdf file in Adobe Reader (outside Excel). That work ok. But when I try to use parameter to specify a page number, zoom etc. it does not do what I expect.
From shell the following work successful:
AcroRd32.exe /A "page=2,zoom=100" "C:\Tmp\manual.pdf"
In VBA I use ShellExecute API function:
sParam = "/A " & Chr(34) & "page=2,zoom=100" & Chr(34)
Call ShellExecute(0&, "Open", "c:\tmp\manual.pdf", sParam, vbNullString, SW_SHOWNORMAL)
It opens the pdf file, but ignores the parameters.
If I open the url "c:\tmp\manual.pdf#page=2& zoom=90" in Internet Explorer (use the Shell function in Excel), it work as expected.
My question is: How can I open a pdf file with parameters (page,zoom, nameddest etc) from Excel VBA?
From VBA in Excel 2007 I want to open a pdf file in Adobe Reader (outside Excel). That work ok. But when I try to use parameter to specify a page number, zoom etc. it does not do what I expect.
From shell the following work successful:
AcroRd32.exe /A "page=2,zoom=100" "C:\Tmp\manual.pdf"
In VBA I use ShellExecute API function:
sParam = "/A " & Chr(34) & "page=2,zoom=100" & Chr(34)
Call ShellExecute(0&, "Open", "c:\tmp\manual.pdf", sParam, vbNullString, SW_SHOWNORMAL)
It opens the pdf file, but ignores the parameters.
If I open the url "c:\tmp\manual.pdf#page=2&
My question is: How can I open a pdf file with parameters (page,zoom, nameddest etc) from Excel VBA?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/questions/20949436/Open-a-PDF-document-and-goto-specific-page.html
Dim AVDoc As Acrobat.CAcroAVDoc
Dim AVPageView As Acrobat.CAcroAVPageView
Dim AcroApp As Acrobat.CAcroApp
Set AcroApp = CreateObject("AcroExch.App
Set AVDoc = CreateObject("AcroExch.AVD
AVDoc.Open(URL, "")
Set AVPageView = AVDoc.GetAVPageView
AVPageView.Goto(4)