VBA CurDir Function

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.