Display text link to open specific PDF page from Excel

Fiona picture Fiona · Dec 2, 2010 · Viewed 9.9k times · Source

I found a VBA code online that opens up an internal (shared drive) PDF document page in IE (e.g. goes to page 8 of PDF file). I would like to display text in the cell for a user to click (e.g. "Click here to view").

Problem: The cell currently displays '0' and I have to go to the function bar and hit [Enter] to execute.

Excel Version: 2003

Function call:

=GoToPDFpage("S:\...x_2011.pdf",8)

VBA Code:

Function GoToPDFpage(Fname As String, pg As Integer)
Set IE = CreateObject("InternetExplorer.Application")
With IE
.Navigate Fname & "#page=" & pg
.Visible = True
End With
End Function

:EDIT:

I was able to display text, but it's still not a link like I wanted.

="Click to view" & GoToPDFpage("S:\...x_2011.pdf",8)

Thank you for your help.

Answer

CaBieberach picture CaBieberach · Dec 3, 2010

Try Menu->Data->Data Validation. In the 2nd tab you can write your message.