Open a PDF file from a Form

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

Hope someone can help. Is it possible to set up so if you click on a
command button it opens a PDF document without having to specify what
software opens the PDF file. Many thanks.
 
Yes, use the FollowHyperlink

Application.FollowHyperlink "c:\FileName.pdf"

It will open the application as it set up in windows.
 
Thanks for the reply, would it be possible to get the path for the PDF file
from a field in a table as well as the name of the file. Any sample code to
point me in the right direction would be great.
 
Just an example, without knowing how you Db is build
============================
Dim PathName As String, FileName as String
PathName = Dlookup("[Path field name]","[Table Name]")
FileName = Dlookup("[File field name]","[Table Name]")

Application.FollowHyperlink PathName & FileName
============================
 
Back
Top