Excel ChDir Function (VBA)
How to use the ChDir Function (VBA)
This Excel tutorial explains how to use the Excel ChDir function with syntax and examples using VBA.
SUMMARY:
The Excel VBA ChDir function allows you to change the current directory or folder.
PURPOSE:
To changes the current directory or folder.
RETURN VALUE:
The ChDir function does not return any value, but rather changes the current folder or directory on the current drive.
SYNTAX:
ChDir path
ARGUMENTS:
The ChDir function syntax has the following arguments:
- path: Required. The path argument is a string expression that identifies which directory or folder becomes the new default directory or folder.
- The path may include the drive.
- If no drive is specified, ChDir changes the default directory or folder on the current drive.
REMARKS:
- The ChDir statement changes the default directory or folder but does not change the default drive. A different statement, ChDrive, changes the default drive.
- On the Power Macintosh, the default drive always changes to the drive specified in path. Full path specifications begin with the volume name, and relative paths begin with a colon (:). ChDir resolves any aliases specified in the path:
- If "path" is left blank, then the default directory is changed on the current drive.