Run file from Visual Basic 6
You can run all type of file from Visual Basic.
1. Create new project

2. Create a text box and a command button.

3. Double click the Command1 button and type code below.
'======================================================
If Right(Text1, 3) = "exe" Or Right(Text1, 3) = "com" Then
Shell (Text1)
Else
Dim x As String
x = Text1.Text
Set execute = CreateObject("Wscript.shell")
execute.run x
End If
'=======================================================
4. Click Run file button so file can be run from this program

Note:
- You just type shell command for run *.exe file and *.com file
- Error will occured if you run the file that contains "space character"
1. Create new project
2. Create a text box and a command button.
3. Double click the Command1 button and type code below.
'======================================================
If Right(Text1, 3) = "exe" Or Right(Text1, 3) = "com" Then
Shell (Text1)
Else
Dim x As String
x = Text1.Text
Set execute = CreateObject("Wscript.shell")
execute.run x
End If
'=======================================================
4. Click Run file button so file can be run from this program
Note:
- You just type shell command for run *.exe file and *.com file
- Error will occured if you run the file that contains "space character"
Comments
Post a Comment