ShellExecute (sVerb, sFile, sExtraParams, sWorkingDirectory, windowstate)

Performs a "ShellExecute" function on the given file. This lets you tell the Windows shell to perform an opera­tion on a specified file.

The nice thing about ShellExecute is that you don't need to know what specific application is registered to handle a particular type of file. For technical background information, see the "ShellExecute" function in the Windows Shell API documentation.

ShellExecute Parameters

Table 5.7: ShellExecute Parameters




A single word that specifies the action to be taken. See the table below for possible values.


The filespec parameter can be any valid path. Use double quotes around complex path names with embedded spaces. It can also be the name of an exe­cutable file.


Optional parameters:  It specifies the parameters to be passed to the application that ultimately runs . The format is determined by the verb that is to be invoked, and the application that runs.  


The working directory when the command runs. If empty, then the project home directory is used.


An integer that specifies the size and state of the win­dow that opens. Valid values are: 1 = normal, 2 = mini­mized, 3 = maximized.

sVerb Values

The sVerb parameter is a single word string that specifies the action to be taken by Shell Execute.

Table 5.8: Values for sVerb Parameter

sVerb Value



Opens an editor for the file.


The function explores the folder specified.


The function opens the file specified. The file can be an executable file or a document file. It can also be a folder.


The function prints the document file specified. If filespec is not a document file, the function will fail.


Displays the file or folder's properties.


Launches the Find Files application found on the Start menu.

"" (empty string)

Ships  this parameter to ShellExecute.                      



To browse a web site:

ShellExecute("open", "", "", "", 1)

To open a document file:

ShellExecute("open", "somefile.doc", "", "", 1)

To explore your Windows documents file folder:

ShellExecute("explore", "C :\Documents and Settings", "", "", 1)

To launch Internet Explorer:

ShellExecute("", "iexplore", "", "", 1)

To preview a file in Internet Explorer:

ShellExecute("", "iexplore somefile.htm", "", "", 1)

To search for files in the current project folder:

ShellExecute("find",  filespec, "", "", 1)