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

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


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.


Using advapi32.dll, you can get the USERPROFILE via

Environ("USERPROFILE")

Connect this with the "Application Data" directory (which has a standard, specific name) to get what you want

CStr(Environ("USERPROFILE") & "\Application Data")

For more information, check out MSDN