VBA How to get path to The Current Users Application data folder?

Binary Worrier picture Binary Worrier · Jun 10, 2009 · Viewed 64.2k times · Source

In general,

Using VBA, how do I determine where the Current users Application Data folder is?

The FileSystemObjects special folders only knows about 3 folders

  • WindowsFolder
  • SystemFolder
  • TemporaryFolder

Specifically, I need a Word Macro to copy a file to the a folder under the Application Data folder.

e.g. In VB.Net I can use My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData to do this

Answer

Eric picture Eric · Jun 10, 2009

You can use Environ("AppData") to get this path. Environ will pull any system variable, which can be found by using the set command at the DOS prompt.