See Also Example
Returns the current path for the specified drive.
Syntax
CurDir[$] [(drive)]
Remarks
CurDir returns a Variant
The argument drive is a string expression
If no drive is specified or if drive is zero-length, CurDir[$] returns the path for the current drive. This is similar to using the CHDIR command at the system prompt without specifying a path.
An error occurs if the first character in drive lies outside the range A to lastdrive. An error also occurs if the first character in drive is not a letter, or if it corresponds to a drive that doesn't exist.
ChDir Statement
ChDrive Statement
MkDir Statement
RmDir Statement
CurDir, CurDir$ Functions Example
The example uses CurDir to return the name of the current directory. To try this example, paste the code into the Declarations section of a form. Then press F5 and click the form.
Sub Form_Click ()
Dim Msg, NL ' Declare variables.
NL = Chr(10) ' Define newline.
Msg = "The current directory is: "
Msg = Msg & NL & CurDir ' Get current directory.
MsgBox Msg ' Display message.
End Sub