VBA CurDir Function
In this Article
CurDir Description
Returns the current path.
Simple CurDir Examples
Assume current path on C drive is “C:\Windows”
Assume current path on D drive is “D:\MyFolder”
Assume current drive is C drive.
MsgBox CurDir
MsgBox CurDir("C")
Result: “C:\Windows”
MsgBox CurDir("D")
Result: “D:\MyFolder”
CurDir Syntax
In the VBA Editor, you can type “CurDir(” to see the syntax for the CurDir Function:
The CurDir function contains an argument:
Drive: [Optional] A string expression representing a directory. If ommitted the current directory is used.
VBA Coding Made Easy
Stop searching for VBA code online. Learn more about AutoMacro - A VBA Code Builder that allows beginners to code procedures from scratch with minimal coding knowledge and with many time-saving features for all users!
Learn More!