kiwitoad
asked on
question from a newbie (a real one)
i want to launch an external executable file (C:\start.exe)
how can i make this happen whith a command button?
how can i make this happen whith a command button?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This way you can open any file, like .txt etc....
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 Command1_Click()
Call ShellExecute(hwnd, "Open", ("C:\start.exe"), "", App.Path, 1)
End Sub
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 Command1_Click()
Call ShellExecute(hwnd, "Open", ("C:\start.exe"), "", App.Path, 1)
End Sub
Sanker, why dimension as a double -- shell returns an long integer...
Bob,
Shell returns well a double. This number is the task id if the shell command is succefull procced or is zero when not.
Shell returns well a double. This number is the task id if the shell command is succefull procced or is zero when not.
kiwitoad:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
Experts: Post your closing recommendations! Who deserves points here?
Moderator, my recommended disposition is:
Accept RoryR's comment(s) as an answer.
DanRollins -- EE database cleanup volunteer
Accept RoryR's comment(s) as an answer.
DanRollins -- EE database cleanup volunteer
Private Sub Command1_Click()
Dim rc as Double
rc = Shell("C:\start.exe", vbNormalFocus)
End Sub
Remember to dimension it as a double.