Shell Function

Syntax

Shell(Name$[, WindowType])

Group

Miscellaneous

Description

Executes 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, it returns the task ID.

Pocket PC

The WindowType parameter is ignored.

Sandbox

Sandbox mode blocks this function.

Parameters

Parameters Description
Name$ 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 double quotes.)
WindowType Controls how the application main window is displayed. See the table below.

 

WindowType Value Effect
vbHide 0 Hides Window
vbNormalFocus 1, 5, 9 Normal Window
vbMinimizedFocus 2 Minimized Window (default)
vbMaximizedFocus 3 Maximized Window
vbNormalNoFocus 4, 8 Normal Deactivated Window
vbMinimizedNoFocus 6, 7 Minimized Deactivated Window

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

See also

AppActivate, SendKeys