Siebel VB Language Reference > Siebel VB Language Reference >

Shell Function


This standard VB function starts a Windows application and returns its task ID.

Syntax

Shell(pathname, [windowStyle])

Argument
Description
pathname
A string or string expression evaluating to the name of the program to execute
windowStyle
An integer indicating how the program's window is to be displayed:
  • 1 if a normal window with focus
  • 2 if a minimized window with focus
  • 3 if a maximized window with focus
  • 4 if a normal window without focus
  • 7 if a minimized window without focus

Returns

The task ID for the program, a unique number that identifies the running program.

Usage

Shell runs an executable program. Pathname can be the name of any valid .COM, .EXE, .BAT, or .PIF file. Arguments and command line switches can be included. If pathname is not a valid executable file name, or if Shell cannot start the program, an error message occurs.

If windowStyle is not specified, the default of windowStyle is 1 (normal window with focus).

Example

This example opens Microsoft Excel upon the click of a button. For other examples, read Right Function and SendKeys Statement.

Sub Button1_Click
   Dim i as long
   i = Shell("C:\Program Files\Microsoft
   Office\Office\EXCEL.EXE",1)
End Sub

See Also

SendKeys Statement


 Siebel VB Language Reference
 Published: 18 June 2003