Home Privacy Policy Feedback Link to us Site Map Forums

Excel: CurDir Function (VBA only)


In Excel, the CurDir function returns the current path.

The syntax for the CurDir function is:

CurDir( drive )

drive is an optional parameter. If this parameter is omitted, the CurDir function assumes the current drive.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

CurDir () would return "C:\Documents and Settings\user\My Documents"
CurDir ("G") would return "G:\"

VBA Code

The CurDir function can only be used in VBA code. For example:

Dim LResult As String

LResult = CurDir ()

In this example, the variable called LResult would now contain the value "C:\Documents and Settings\user\My Documents".