Sub LoadEXE(Dir As String)
On Error Goto err: X% = Shell(Dir, 1): NoFreeze% = DoEvents(): Exit Sub Exit Sub err: 'make your own error messages like mine below, or use the default: If err.Number = 6 Then Exit Sub MsgBox "Please make sure that the application you are trying to launch is located in the correct folder." & _ vbCrLf & "If not, Do this and retry launching the application.", vbExclamation 'default: MsgBox "Error:" & vbCrLf & err.Description & _ vbCrLf & err.Number, vbExclamation End Sub |