Sunday, July 10, 2011

How to run a exe file?






Option Explicit

'I have made the code to run the calculator, which
' is present in every Windows Based PC.
'the command button  click() event triggers
'the application to run.

'General Syntax is
'RetVal = Shell([Pathname of EXE], [WindowStyle As vbAppWinStyle = vbMinimisedFocus])

'----------------CODE--------------------
Private Sub Command1_Click()
Dim RetVal
RetVal = Shell("C:\WINDOWS\System32\calc.exe", 1)    ' Run Calculator.
End Sub

The Shell function runs a specified .EXE , .COM , .BAT OR .PIF  program.

A% = Shell ("calc.exe")

B% = Shell ("C:\WINDOWS\System32\calc.exe", 1)

VbHide :0
VbNormalFocus :1
VbMinimzedFocus :2
VbMaximizedFocus :3
VbNormalNoFocus :4
VbMinimizedNoFocus :6

No comments:

Post a Comment