When one opens an Excel document D:\db\tmp\test1.xlsm:
-
CurDir()returnsC:\Users\[username]\Documents -
ActiveWorkbook.PathreturnsD:\db\tmp
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.
[ADD]
Resume VBA for different applications
Access D:\db\tmp\test1.accdb, like duckboy81 commented:
- CurDir() => C:\Users\[username]\Documents
- Application.CurrentProject.Path => D:\db\tmp
Excel D:\db\tmp\test1.xlsm:
- CurDir() => C:\Users\[username]\Documents
- ActiveWorkbook.Path => D:\db\tmp
- Application.DefaultFilePath => C:\Users\[username]\Documents
Outlook:
- CurDir() => C:\WINDOWS\System32
- Application.Session.Stores(1).Filepath => D:\programdata\Outlook\myOutlookDocX.pst
PowerPoint D:\db\tmp\test1.ppt:
- CurDir() => C:\Users\[username]\Documents
- ActivePresentation.Path => D:\db\tmp
Word D:\db\tmp\test1.docx:
- CurDir() => C:\Users\[username]\Documents
- Application.ActiveDocument.Path => D:\db\tmp
- Application.ActiveDocument.FullName => D:\db\tmp\test1.docx
- Application.StartupPath => C:\users\[username]\appdata\roaming\microsoft\word\startup