Welcome toExcel.Tips.Net
Tips.Net Home
ExcelTips Home
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Learn Access Now
Free Printable Forms
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Legal Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Wedding Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site
Adding a Little Animation to Your Life
Converting a Range of URLs to Hyperlinks
Making the Formula Bar Persistent
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 versions: 97 2000 2002 2003 2007
Organize Your Data! Using the powerful sorting capabilities of Excel can help you get your data into just the order you need. Find out how you can use the full capabilities of sorting to your benefit.