Hi all I'm looking to open a PDF file (with a known location) via a macro run from Solidworks I did some research and nothing conclusive I find solutions from Excel but not from solidworks
Hello On the one hand, you have to declare the function to use the default pdf opening program:
Private Declare PtrSafe 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
Then call it that:
ret = ShellExecute(0, "open", "nom de fichier", vbNullString, "répertoire de stockage", 1)
Great thank you for your answer, it allowed me to move forward I'm on the right track I think Adobe opens but the file does not I'm digging again
Private Declare PtrSafe 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
Sub main()
ret = ShellExecute(0, "open", "C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe", vbNullString, "U:\PLAN\01 PDF\USMEC000121-C.PDF", 1)
End Sub
I was almost there as well thank you for your help
Private Declare PtrSafe 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
Sub main()
ret = ShellExecute(0, "open", "USMEC000121-C.PDF", vbNullString, "U:\PLAN\01 PDF\", 1)
End Sub