Option Compare Database
Option Explicit
'Code Courtesy of Dev Ashish
Private Declare Function apiShellExecute 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
Public Sub ShellEx(ByVal Path As String, Optional ByVal Parameters As String, Optional ByVal HideWindow As Boolean)
On Error GoTo Err_Handler
If Dir(Path) > "" Then
apiShellExecute 0, "open", Path, Parameters, "", IIf(HideWindow, 0, 1)
Else
MsgBox "Can't find specified file"
End If
Exit_Handler:
Exit Sub
Err_Handler:
MsgBox "Error " & Err.Number & " in ShellEx procedure : " & Err.Description, vbOKOnly + vbCritical
Resume Exit_Handler
End Sub