CurDir, CurDir$
Both CurDir and CurDir$ functions return the current system environment path for the specified drive (Drv).
The parameter Drv must be a string or expression that can represent a valid DOS file structure drive letter. The Drv may be local to the computer, or mapped from anywhere on the network connected to the computer. If Drv contains more than one letter, only the first character is used.
Note: The file system keeps track of the current drive, and the current directory of every drive. Use the CurDir statement to determine the current directory. The current drive letter can be extracted from the Left character returned in the CurDir statement.
If no Drv is specified or if Drv is a zero-length string (" "), CurDir functions return the system environment path for the current drive.
Syntax
CurDir(Drv)
Drv:
A string or expression that can represent a valid DOS file structure drive letter. Drv is case insensitive and must end with a colon (:). The Drv may be local to the computer, or mapped from anywhere on the network connected to the computer. Drv is often included as part of the Path parameter.
Return Value
CurDir returns a Variant containing a string; CurDir$ returns a String.
Related Functions
ChDir | ChDrive | Dir | MkDir | RmDir
Example
Dim vntCurPath As Variant
Dim strCurPath As String
vntCurPath = CurDir() ' store current path as variant
strCurPath = CurDir$() ' store current path as string