ChDir Statement

變更目前目錄或磁碟機。

警告圖示

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


語法

ChDir Text As String

參數:

Text:用於指定目錄路徑或磁碟機的任意字串型表示式。

評註圖示

如果您僅是要變更目前磁碟機,請輸入磁碟機號,並在後面加上冒號。


錯誤代碼:

5 無效的程序呼叫

76 找不到路徑

示例:

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