View Single Post
 
Old 12-11-2016, 04:59 PM
poetofpiano poetofpiano is offline Windows 8 Office 2013
Novice
 
Join Date: Sep 2015
Posts: 25
poetofpiano is on a distinguished road
Default

Thank you so much gmayor. With your help, I was able to make it work:

Code:
Sub GoToPDFhyperlinkPage()
Dim targetLink As String
Dim targetName As String
Dim pageNumber As Integer
Dim pathPDF As String
targetName = Selection.Hyperlinks(1).Name
parts = Split(targetName, "page=")
pageNumber = parts(1)
pathPDF = Selection.Hyperlinks(1).Address
Call OpenPagePDF(pathPDF, pageNumber)
End Sub

Public Function OpenPagePDF(sMyPDFPath As String, iMyPageNumber As Integer)
Dim RtnCode, AdobePath As String
AdobePath = Chr(34) & "C:\Program Files\SumatraPDF\SumatraPDF.exe" & Chr(34)
' need it enclosed in quotes b/c there is a space in "Program Files"
RtnCode = Shell(AdobePath & " " & Chr(45) & "page" & " " & iMyPageNumber & " " & Chr(45) & "reuse" & Chr(45) & "instance" & " " & Chr(34) & sMyPDFPath & Chr(34), 1)
End Function
Reply With Quote