Share via


Visual Basic for Applications Reference

CurDir Function Example

This example uses the CurDir function to return the current path.

  ' 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".