If you run the following VBA Code in any Office application Word/Excel/Access it does not change the default path if the file in which the code resides is saved:
I've tested it on Windows 10, MS-Office 2010 x86, 2016 Plus x86 and O365 x64
For example create a new Excel file without saving it!
Put the following code in a module or worksheet/workbook-module.
Run the code The result is: the dialogbox opens your windows-user folder.
Now save the file somewhere.
Run the code again. The result is: the dialogbox does not opens your windows-user folder.!
You could do the test with some other folders/drives. The result is the same - at least on my PCs.
Sub ChangeDefaultPath()
' For me are these two lines of code importent.
' Why they do not work as they should.
ChDrive "C"
ChDir "C:\Users\" & Environ("USERNAME")
' This line of code is just for testing.
' You could comment it out and use F12 or save as from the application menue manually.
Application.Dialogs(xlDialogSaveAs).Show
End Sub
Is this issue known? Is there a fix for that without workarounds?
Thanks for any hints and helps.