CurDir Function

Returns a FixStr (String) representing the current path.

Syntax

CurDir[$][(drive)]

Remarks

The optional drive argument is a string expression that specifies an existing drive. If no drive is specified or if drive is a zero-length string (""), CurDir returns the path for the current drive.

CurDir Function (Apple Power Macintosh)

The optional drive argument is a string expression that specifies an existing drive. The CurDir function ignores any specified drive and simply returns the path for the current drive.

The CurDir$ for returns String values. The CurDir form returns FixStr values.

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.
Dim MyPath
MyPath = CurDir      ' Returns "C:\WINDOWS\SYSTEM".
MyPath = CurDir("C") ' Returns "C:\WINDOWS\SYSTEM".
MyPath = CurDir("D") ' Returns "D:\EXCEL".

' อเ Macintosh:
' Drive names are ignored. The path for the current disk is returned.
' Assume current path on drive HD is - "HD:MY FOLDER".
' Assume HD is the current drive.
' Assume drive MD also exists on this computer.
Dim MyPath2
MyPath2 = CurDir      ' Returns "HD:MY FOLDER".
MyPath2 = CurDir("HD")' Returns "HD:MY FOLDER".
MyPath2 = CurDir("MD")' Returns "HD:MY FOLDER".

See Also

ChDir Statement, ChDrive Statement , MkDir Statement, RmDir Statement