I'm using this VBA code and I'm trying to open a pdf file from MS Access 2007 form.
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
If I use this line no issues:
ShellExecute 0, "Open", "C:\Temp\myfile.pdf", "", "", vbNormalNoFocus
However this is what I need since the path name can change..
filename=CurrentProject.Path & "\myfile.pdf"
ShellExecute 0, "Open", filename, "", "", vbNormalNoFocus
Is that possible ?
followhyperlink CurrentProject.Path & "\myfile.pdf"
if you want to use shell, you need to know the path to your pdf (acrobat ) reader