Syntax 

Shell(Name$[, WindowType])


Group 

Miscellaneous 


Description 

Execute program Name$. This is the same as using File|Run from the Program Manager. This instruction can run .COM, .EXE, .BAT and .PIF files. If successful, return the task ID. 


Parameters

Description

Name$ 

This string value is the path and name of the program to run. Command line arguments follow the program name. (A long file name containing a space must be surrounded by literal double quotes.) 

WindowType 

This controls how the application's main window is shown. See the table below. 


WindowType

Value

Effect

vbHide 

Hide Window 

vbNormalFocus 

1, 5, 9 

Normal Window 

vbMinimizedFocus 

Minimized Window (default) 

vbMaximizedFocus 

Maximized Window 

vbNormalNoFocus 

4, 8 

Normal Deactivated Window 

vbMinimizedNoFocus 

Minimized Deactivated Window 


See Also 

AppActivate, SendKeys


Example

Sub Main

    X = Shell("Calc") ' run the calc program

    AppActivate X

    SendKeys "% R" ' restore calc's main window

    SendKeys "30*2{+}10=",1 '70

End Sub