Description
Returns the current path.
Syntax
CurDir[(drive)]
The drive argument is a string expression that specifies an existing drive. In Microsoft Windows, if no drive is specified or if drive is zero-length (""), CurDir returns the path for the current drive. On the Macintosh, CurDir ignores any drive specified and simply returns the path for the current drive.
See Also
ChDir Statement, ChDrive Statement, MkDir Statement, RmDir Statement.
Example
This example uses the CurDir function to return the current path.
' In Microsoft Windows. ' Assume current path on C Drive is "C:\WINDOWS\SYSTEM". ' Assume current path on D Drive is "D:\EXCEL". ' Assume C is the current drive. MyPath = CurDir ' Returns "C:\WINDOWS\SYSTEM". MyPath = CurDir("C") ' Returns "C:\WINDOWS\SYSTEM". MyPath = CurDir("D") ' Returns "D:\EXCEL". ' On the Macintosh. ' Drive letters are ignored. Path for current drive is returned. ' Assume current path on HD Drive is "HD:MY FOLDER". ' Assume HD is the current drive. Drive MD also exists on the machine. MyPath = CurDir ' Returns "HD:MY FOLDER". MyPath = CurDir("HD") ' Returns "HD:MY FOLDER". MyPath = CurDir("MD") ' Returns "HD:MY FOLDER".