hassansheraz
asked on
how to run exe
my question is that i want to just an exe file by clicking the command button.wht will be the code under the
command button.
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.
Dim rc as double
Private Sub Command1_Click()
rc = Shell ("c:\example.exe", vbNormal)
End Sub
Private Sub Command1_Click()
rc = Shell ("c:\example.exe", vbNormal)
End Sub
Hi
I hope it can help you cause it's really working:
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
Const ATTR_NORMAL = 0
Const ATTR_READONLY = 1
Const ATTR_HIDDEN = 2
Const ATTR_SYSTEM = 4
Const ATTR_VOLUME = 8
Const ATTR_DIRECTORY = 16
Const ATTR_ARCHIVE = 32
Private Sub Command1_Click()
Call ShellExecute(hwnd, "Open", Something.exe, "", App.Path, 1)
End Sub
remember if you want to open a file from a directory you need to mention the directory.
if you need any help, I'll be very please to help you.
Mr.Brownstone
I hope it can help you cause it's really working:
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
Const ATTR_NORMAL = 0
Const ATTR_READONLY = 1
Const ATTR_HIDDEN = 2
Const ATTR_SYSTEM = 4
Const ATTR_VOLUME = 8
Const ATTR_DIRECTORY = 16
Const ATTR_ARCHIVE = 32
Private Sub Command1_Click()
Call ShellExecute(hwnd, "Open", Something.exe, "", App.Path, 1)
End Sub
remember if you want to open a file from a directory you need to mention the directory.
if you need any help, I'll be very please to help you.
Mr.Brownstone
Private Sub Command1_Click()
Shell "C:\Program Files\Microsoft Office\Office10\WinWord.ex e", vbNormalFocus
End Sub
Shell "C:\Program Files\Microsoft Office\Office10\WinWord.ex
End Sub
hassansheraz:
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?
Recommendation: Points to bobbit31 (yes that's me, but look at the comments)
Thanks for the input bobbit31. Moderator, my recommended disposition is:
Accept bobbit31's comment(s) as an answer.
DanRollins -- EE database cleanup volunteer
Accept bobbit31's comment(s) as an answer.
DanRollins -- EE database cleanup volunteer
Private Sub Command1_Click()
Shell "something.exe", vbNormalFocus
End Sub