I am using MS Excel 2010 and trying to get the current directory using the below code,
path = ActiveWorkbook.Path
But ActiveWorkbook.Path returns blank.
See Question&Answers more detail:osI am using MS Excel 2010 and trying to get the current directory using the below code,
path = ActiveWorkbook.Path
But ActiveWorkbook.Path returns blank.
See Question&Answers more detail:osI've tested this:
When I open an Excel document D:dbmpest1.xlsm
:
CurDir()
returns C:Users[username]Documents
ActiveWorkbook.Path
returns D:dbmp
So CurDir()
has a system default and can be changed.
ActiveWorkbook.Path
does not change for the same saved Workbook.
For example, CurDir()
changes when you do "File/Save As" command, and select a random directory in the File/Directory selection dialog. Then click on Cancel to skip saving. But CurDir()
has already changed to the last selected directory.