Option Compare Database
Private Const SW_SHOWNORMAL = &H1&
Private Declare Function ShellExecuteA Lib "shell32" ( _
ByVal hwnd As Long, _
ByVal lpszOp As String, _
ByVal lpszFile As String, _
ByVal lpszParams As String, _
ByVal LpszDir As String, _
ByVal FsShowCmd As Long) As Long
Public Sub OpenPDF(ByVal szPDFLocation As String)
Dim Success As Long
' If the function succeeds, it returns a value greater than 32.
Success = ShellExecuteA(0, "open", szPDFLocation, vbNullString, vbNullString, SW_SHOWNORMAL)
If Success > 32 Then
Debug.Print "Success"
Else
' For a list of error codes.
' http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx
Debug.Print "Error= " & Success
End If
End Sub
Private Sub Command1_Click()
Dim NameOfPDF As String
Dim AVDoc As AcroAVDoc
NameOfPDF = 9814634 'to be replaced by a passed varible
OpenPDF "H:\Accounting\Finance-Sales & Marketing\SDamm\WIP\USFS MOD\Downloads\INVOICES\" & NameOfPDF & "-1.pdf"
OpenPDF "H:\Accounting\Finance-Sales & Marketing\SDamm\WIP\USFS MOD\Downloads\INVOICES\" & NameOfPDF & "-2.pdf"
End Sub
|