Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Function Declaration
-
Function Shell(PathName As Variant, Optional WindowStyle As VbAppWinStyle = vbMinimizedFocus) As Double
|
Parameter |
Description |
|---|---|
|
PathName |
String, containing the name of the program to execute and any required arguments or command-line switches; can include directory or folder and drive. |
|
WindowStyle |
Integer corresponding to the style of the window in which the program is to be run. If WindowStyle is omitted, the program is started minimized, with focus. |
Runtime Semantics.
§ Runs an executable program and returns a Double representing the implementation-defined program's task ID if successful, otherwise it returns the data value 0.
§ The WindowStyle parameter accepts these values:
|
Constant |
Value |
Description |
|---|---|---|
|
vbHide |
0 |
Window is hidden and focus is passed to the hidden window. |
|
vbNormalFocus |
1 |
Window has focus and is restored to its original size and position.
|
|
vbMinimizedFocus |
2 |
Window is displayed as an icon with focus. |
|
vbMaximizedFocus |
3 |
Window is maximized with focus. |
|
vbNormalNoFocus |
4 |
Window is restored to its most recent size and position. The currently active window remains active. |
|
vbMinimizedNoFocus |
6 |
Window is displayed as an icon. The currently active window remains active. |
§ If the Shell function successfully executes the named file, it returns the task ID of the started program. The task ID is an implementation-defined unique number that identifies the running program. If the Shell function can't start the named program, an error occurs.
§ Note: by default, the Shell function runs other programs asynchronously. This means that a program started with Shell might not finish executing before the statements following the Shell function are executed.