Link to home
Start Free TrialLog in
Avatar of hassansheraz
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.
ASKER CERTIFIED SOLUTION
Avatar of bobbit31
bobbit31
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shakoor_h
shakoor_h

Try this

Private Sub Command1_Click()
Shell "something.exe", vbNormalFocus
End Sub
Dim rc as double

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
Private Sub Command1_Click()
Shell "C:\Program Files\Microsoft Office\Office10\WinWord.exe", vbNormalFocus
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?
Recommendation: Points to bobbit31 (yes that's me, but look at the comments)
Avatar of DanRollins
Thanks for the input bobbit31.  Moderator, my recommended disposition is:

    Accept bobbit31's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer