by Allen Wyatt
(last updated January 1, 2020)
Gary wants to link from an Excel worksheet to a specific page in a PDF file. He can get Excel to link to the PDF, but it starts on the first page of the PDF, not the page he wants. Gary believes that Excel is ignoring the PDF command that tells it the page he wants. As an example, he can use the formula =HYPERLINK("E:\\test\gary.pdf#5") and Excel ignores the #5 part and opens to the first page of the PDF.
This does, indeed, seem to be the case, Gary. The HYPERLINK worksheet function seems to ignore the page specification for some strange reason. There also doesn't seem to be a way around this problem with the function.
Fortunately, you can use a macro to do the opening, if you desire. The following macro relies upon Internet Explorer to open the PDF and display the proper page:
Sub OpenPDFpage() Dim myLink As String Dim TargetPage As Double Dim objIE As New InternetExplorer myLink = "path/filename.pdf" TargetPage = 7 'Page number to be shown With objIE .Navigate myLink & "#page=" & TargetPage .Visible = True End With End Sub
The code could also be rather easily changed to a function to which you can pass the desired path and target page.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (3350) applies to Microsoft Excel 97, 2000, 2002, and 2003.
Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!
Is your worksheet information destined for a Web page? Here's how you can specify the fonts that should be used when ...Discover More
When you click a link in a browser, the target of that link might open in the same window or in a new window. Getting an ...Discover More
When you copy information from a Web page and paste it into a worksheet, you can end up with more than you bargained for. ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.