2
votes

in VBA there is a ChDir function that allows to set/change the current directory.
That Current Directory is also affected by a user browsing through his drives/folders from Access (or Excel), even if he clicks Cancel in the end without opening anything.
My question is: in the later case, how do I retrieve the Current Directory ?

Note: the CurrentDirectory has nothing to do with the folder of the CurrentDb!

3

3 Answers

3
votes

You want CurDir$:

?CurDir$
c:\temp

ChDir "c:\windows\"

?CurDir$
c:\windows
1
votes

The complement to the ChDir command in VBA is the CurDir function.

0
votes

on VBS

Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Echo WshShell.CurrentDirectory