We help IT Professionals succeed at work.

How to I open from MS Word 2010 a PDF document to a particular Named Destination?

KenHadley
KenHadley asked
on
I use the code below (obtained through a previous question on EE) to open a PDF to a particular page from a Word 2010 VBA macro. In addition to opening to a particular page, I would also like to have another Word 2010 VBA macro that would open a PDF to a particular Named Destination in the PDF. I am unable to figure out how to do this. I presume it involves changing the line below:
    AVDoc.GetAVPageView.GoTo pg
into some other call to something like AVDoc.GoToNamedDestinantion ("MyNamedDest"), but I am unable to figure it out or find it in the Adobe API documentation. Any help would be appreciated.

Ken

Sub OpenAdobeDocAtPage()

    Dim mypath As String
    Dim pg As Integer
    mypath = "c:\Users\Rob\Documents\myPDF.pdf"
    pg = 13
     
    Set AcroApp = CreateObject("AcroExch.App")
    Set AVDoc = CreateObject("AcroExch.AVDoc")
     
    AVDoc.Open mypath, ""
    Set PDDoc = AVDoc.GetPDDoc
    AVDoc.GetAVPageView.GoTo pg 'put whatever page you want to go to
                                'there but keep in mind that page 1 is 0
    AcroApp.Show
End Sub

Open in new window

Comment
Watch Question