Option ExplicitPrivate Const SW_SHOWNORMAL = 1
Private Const ERROR_FILE_NOT_FOUND = 2&
Private Const ERROR_PATH_NOT_FOUND = 3&Private Declare Function WinExec Lib "kernel32" (ByVal lpCmdLine As String, ByVal nCmdShow As Long) As LongPrivate Sub Command1_Click()
    Dim lngResult As Long
    
    lngResult = WinExec("notepad.exe", SW_SHOWNORMAL)
    
    Select Case lngResult
    Case ERROR_FILE_NOT_FOUND
        MsgBox "File not find.", vbInformation
    Case ERROR_PATH_NOT_FOUND
        MsgBox "Path not find.", vbInformation
    Case Else
    End Select
End Sub