Name
Shell Function
Class
Microsoft.VisualBasic.Interaction
Syntax
Shell(pathname[,style][, Wait][, Timeout] )-
pathname Use: Required
Data Type: String
Name of the program to execute
-
style Use: Optional
Data Type:
AppWinStyleenumerationThe style of window and whether it receives the focus; see Section .
-
Wait Use: Optional
Data Type: Boolean
Boolean indicating whether to wait for the
pathnameapplication to finish execution before continuing execution of subsequent code-
Timeout Use: Optional
Data Type: Integer
If
WaitisTrue, number of milliseconds to wait for thepathnameapplication to terminate before theShellfunction times out
Return Value
An Integer representing the Process ID, or 0
Description
Launches another application and, if successful, returns that application’s task ID
Rules at a Glance
pathnamecan include a drive letter. If a drive letter is not included inpathname, the current drive is assumed.pathnamecan include a folder name. You can use either a fully qualified path (i.e., starting from the root directory) or a relative path (i.e., starting from the current directory). If the folder name is not included inpathname, the current folder is assumed.pathnamecan include any command-line arguments and switches required by the application. For example:Shell("notepad.exe c:\data.txt", AppWinStyle.NormalFocus)launches Notepad, which loads the file
data.txt.Visual Basic includes the following intrinsic constants for setting the
styleargument:-
AppWinStyle.Hide Value: ...
-
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access