CurDir() function VBA

Posted: May 8, 2013 by Theodoulus in VBA
Tags: ,

Many times you want to know the complete path where you are currently working in.
So, CurDir() is the solution.

Now, the question is, “How to work with Curdir() in VBA”.

Ok, let me tell you the The syntax for the CURDIR function is:
                                                                                                     CurDir( drive )

drive is an optional parameter. If you provide this parameter, this function will give you the path which you provide but if you omit this parameter or pass an empty string, this will return the complete path where your current workbook is placed in.

For Example:

curdir("")                  ' will return "C:\Users\user\Documents"
CurDir()                    ' will return "C:\Users\user\Documents"
CurDir("E")                 ' will return "E:\"

Share your thoughts/feedback

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s