Microsoft Office Development and Consultancy
 Home|VBA|C#|Excel|Word|PowerPoint|Outlook|Tools|Newsletter|Contact 
 VBA > Syntax > Other > SHELL

 SHELL(pathname [,windowstyle])
 Returns the program's task id from running an executable programs (Double).

 pathnameThe full path of the program to execute (String).
 windowstyleThe constant specifying the style of the window (Integer):
0 = vbHide
1 = vbNormalFocus
2 = vbMinizedFocus
3 = vbMaximizedFocus
4 = vbNormalNoFocus
5 = vbMininizedNoFocus

 REMARKS
 
  • The taskID is a unique number that identifies the running program.
     
  • If "windowstyle" is left blank, then 2 is used.
     
  • By default this function runs other programs asynchronously.
     
  • Specifying a windowstyle of 1 opens the application in normal size and gives it focus.
     
  • In .NET this is available in Microsoft.VisualBasic namespace.

     EXAMPLES
     
    Dim dbAppID As Double
    dbAppID = Shell("Microsoft Word", 1)
    dbAppID = Shell("C:\Windows\Calc.exe", 1)
     

     Syntax - S | Index - S 

     © Better Solutions Limited 27-Mar-2014Top