Okay so ...
First you need this function
This will check, if the file specified is existing and, if so, it will return "true".
Lets say you got a Command Button named "Command1" and you want to start the file "hello.bat" in your programs directory.
First you need this function
Code:
Function FileExists(File As String) As Boolean On Error Resume Next FileExists = False FileExists = Dir(File) <> "" End Function
Lets say you got a Command Button named "Command1" and you want to start the file "hello.bat" in your programs directory.
Code:
Private Sub Command1_Click()
Dim sFile As String 'Dim a new variable called sFile
sFile = App.Path & "\hello.bat" 'Save the file path to the new variable. In this case, the "hello.bat" is in the same directory as your program's .EXE
If FileExists(sFile) = True Then 'Check wether this file exists or not
Shell sFile, vbWindowState 'If it exists, start it
Else
MsgBox "File does not exists" 'If it doesnt exist, return an error
End If
End Sub
DO YOU WANT ANYTHING IN RETURN? SOME CREDITS? SOMETHING ELSE?
