ChDir

Syntax

ChDir Path$

Remarks

Sets the current folder to the drive or folder specified by Path$. If the drive is omitted, the search for the specified path starts at the current folder. You can use ChDir to set the folder so that you do not have to specify the complete path when you use FileOpen to open a document.

Examples

This example changes the folder and then displays the Open dialog box so that you can open a document stored in that folder. You could create a macro like this for a folder you use often and assign the macro to a toolbar button for quick access. On the Macintosh, substitute a folder name such as
HD:WORD 6:LETTERS.


ChDir "C:\WINWORD\LETTERS\PERSONAL"
Dim dlg As FileOpen
button = Dialog(dlg)
If button = -1 Then FileOpen dlg

The following Windows example determines whether the current folder is C:\WINWORD and changes to it if it is not.


If Files$(".") <> "C:\WINWORD" Then ChDir "C:\WINWORD"

Here is the same example, rewritten for the Macintosh:


If Files$(":") <> "HD:WORD 6" Then ChDir "HD:WORD 6"

See Also

Connect, CountDirectories(), Files$(), GetDirectory$(), MkDir, RmDir