Shell.Open method

Opens the specified folder.

Syntax

iRetVal = Shell.Open(
  vDir
)

Shell.Open( _
  ByVal vDir As Variant _
) As Integer

Parameters

vDir [in]

Type: Variant

A string that specifies the path of the folder or one of the ShellSpecialFolderConstants values. Note that the constant names found in ShellSpecialFolderConstants are available in Visual Basic, but not in VBScript or JScript. In those cases, the numeric values must be used in their place.

If vDir is set to one of the ShellSpecialFolderConstants and the special folder does not exist, this function will create the folder.

Examples

The following example shows Open in use. Proper usage is shown for JScript, VBScript, and Visual Basic.

JScript:

<script language="JScript">
    function fnShellOpenJ()
    {
        var objShell = new ActiveXObject("shell.application");
        var ssfWINDOWS = 36
        
        objShell.Shell.Open(ssfWINDOWS);
    }
</script>

VBScript:

<script language="VBScript">
    function fnShellOpenVB()
        dim objShell
        
        set objShell = CreateObject("shell.application")
        objShell.Shell.Open("C:\\")

        set objShell = nothing
    end function
 </script>

Visual Basic:

Private Sub fnShellOpenVB()
    Dim objShell As Shell
    
    Set objShell = New Shell
    objShell.Shell.Open(ssfPERSONAL)

    Set objShell = Nothing
End Sub

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Shldisp.h
IDL
Shldisp.idl
DLL
Shell32.dll (version 4.71 or later)

See also

Shell

Explore