Consulting

Results 1 to 2 of 2

Thread: Excel VBA - Change the current page of an already open PDF

  1. #1
    VBAX Newbie
    Joined
    Nov 2015
    Posts
    2
    Location

    Excel VBA - Change the current page of an already open PDF

    Hi,
    I've got some code that works well for word documents but I can't seem to get it to work for PDF's. The code is for documents that are already open and all it needs to do is change the page of the specific document and then show it on the screen above all other windows. Note that multiple files are likely to be open so it needs to be smart enough to determine which pdf is the correct one.
    The working code for word docs is:

    IsOpen = IsFileOpen(CompletePath)
    If IsOpen = True Then
    Dim objWord As Object
    Set objWord = GetObject(CompletePath)
    Set objWordinstance = objWord.Application
    objWordinstance.Selection.Goto What:=1, Which:=2, Name:=page
    objWordinstance.Visible = True
    AppActivate (NameOfFile)
    GoTo Ending
    End If


    The code that I can't get working is:

    IsOpen = IsFileOpen(FullPathway)
    If IsOpen = True Then
    MsgBox "File is already Open."
    Dim objPDF As Acrobat.AcroApp 'should this be object?
    Set objPDF = GetObject(FullPathway, Acrobat.AcroApp)
    Set objPDFinstance = objPDF.Application
    objPDFinstance.Selection.Goto What:=1, Which:=2, Name:=page
    objPDFinstance.Visible = True
    AppActivate (FullPathway)
    GoTo Ending
    End If

    FullPathway is where the pdf document is stored on the computer.
    Anyone able to help with this?
    Regards,
    Whiss

  2. #2
    VBAX Newbie
    Joined
    Nov 2015
    Posts
    2
    Location
    I found out that it is extremely difficult to work with PDF's to do this task so I ended up changing my entire system to work with Internet Explorer to view the files. In the end I don't need help any more. Cheers.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •