VBA GetSpecialFolder

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

The FileSystemObject VBA GetSpecialFolder function returns the path to the specified special folder (Windows, System or Temporary folder).
This function is especially useful if you are looking for a directory to create temporary processing files to avoid creating junk files in default user folders.

VBA GetSpecialFolder Syntax

One of 3 values (constants):

Folder Value Description
WindowsFolder 0 Windows folder usually “C:\Windows”
SystemFolder 1 System folder usually containing libraries, fonts, device drivers this is usually “C:\Windows\System32”
TemporaryFolder 2 Temporary user folder. This is usually “C:\Users\user name\AppData\Local\Temp”

In case you have not referenced Microsoft Scripting Runtime library in VBA Project use 0-2 values instead.

VBA GetSpecialFolder Examples

Simply the best place to learn Excel VBA