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
Specifically, I need a Word Macro to copy a file to the a folder under the Application Data folder.
eg In VB.Net I can use My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData
to do this
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.