ChDir Statement

Changes the current directory or drive.

Hoiatav ikoon

This statement currently does not work as documented. See this issue for more information.


ChDir Text As String


Text: Any string expression that specifies the directory path or drive.

Märkuse ikoon

If you only want to change the current drive, enter the drive letter followed by a colon.

Error codes:

5 Invalid procedure call

76 Path not found


Sub ExampleChDir

Dim sDir1 As String , sDir2 As String

    sDir1 = "c:\Test"

    sDir2 = "d:\Private"

    ChDir( sDir1 )

    MsgBox CurDir

    ChDir( sDir2 )

    MsgBox CurDir

End Sub