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
Private Sub cmd1_Click()
dlg1.DialogTitle = " In | Structurez ** Professional Community ** "
dlg1.InitDir = App.Path
dlg1.Filter = "All Files|*.*"
dlg1.ShowOpen
If Len(dlg1.FileName) Then
MyShell dlg1.FileName, vbNormalFocus
End If
End Sub
Private Function MyShell(PathAndFile As String, Optional ShowCmd As Long = vbNormalNoFocus) _
As Long
File = Mid$(PathAndFile, InStrRev(PathAndFile, "\") + 1)
MyShell = ShellExecute(0, vbNullString, File, Parameters, Path, ShowCmd)
If MyShell < 32 Then Shell PathAndFile, ShowCmd
End Function