Skip to content

Instantly share code, notes, and snippets.

@guwidoe
Last active April 12, 2023 15:34
Show Gist options
  • Save guwidoe/43016947dad44457e4a90112ce32a4cf to your computer and use it in GitHub Desktop.
Save guwidoe/43016947dad44457e4a90112ce32a4cf to your computer and use it in GitHub Desktop.
Obtaining Known Folders on Windows and Mac with VBA

Table comparing CSIDL and SSFC

Including example return values of

Code to genrerate this table for your own pc is provided below.

Dec Hex CSIDL code name ssfC code name SHGetFolderPathA return value Equal? oShell.NameSpace().Self.Path return value
0 &H0 CSIDL_DESKTOP ssfDESKTOP C:\Users\Username\Desktop True C:\Users\Username\Desktop
1 &H1 CSIDL_INTERNET False ::{871C5380-42A0-1069-A2EA-08002B30309D}
2 &H2 CSIDL_PROGRAMS ssfPROGRAMS C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
3 &H3 CSIDL_CONTROLS ssfCONTROLS False ::{26EE0668-A00A-44D7-9371-BEB064C98683}\0
4 &H4 CSIDL_PRINTERS ssfPRINTERS False ::{21EC2020-3AEA-1069-A2DD-08002B30309D}::{2227A280-3AEA-1069-A2DE-08002B30309D}
5 &H5 CSIDL_PERSONAL ssfPERSONAL C:\Users\Username\Documents True C:\Users\Username\Documents
6 &H6 CSIDL_FAVORITES ssfFAVORITES C:\Users\Username\Favorites True C:\Users\Username\Favorites
7 &H7 CSIDL_STARTUP ssfSTARTUP C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
8 &H8 CSIDL_RECENT ssfRECENT C:\Users\Username\AppData\Roaming\Microsoft\Windows\Recent True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Recent
9 &H9 CSIDL_SENDTO ssfSENDTO C:\Users\Username\AppData\Roaming\Microsoft\Windows\SendTo True C:\Users\Username\AppData\Roaming\Microsoft\Windows\SendTo
10 &HA CSIDL_BITBUCKET ssfBITBUCKET False ::{645FF040-5081-101B-9F08-00AA002F954E}
11 &HB CSIDL_STARTMENU ssfSTARTMENU C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu
12 &HC CSIDL_MYDOCUMENTS True
13 &HD CSIDL_MYMUSIC C:\Users\Username\Music True C:\Users\Username\Music
14 &HE CSIDL_MYVIDEO C:\Users\Username\Videos True C:\Users\Username\Videos
15 &HF True
16 &H10 CSIDL_DESKTOPDIRECTORY ssfDESKTOPDIRECTORY C:\Users\Username\Desktop True C:\Users\Username\Desktop
17 &H11 CSIDL_DRIVES ssfDRIVES False ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}
18 &H12 CSIDL_NETWORK ssfNETWORK False ::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}
19 &H13 CSIDL_NETHOOD ssfNETHOOD C:\Users\Username\AppData\Roaming\Microsoft\Windows\Network Shortcuts True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Network Shortcuts
20 &H14 CSIDL_FONTS ssfFONTS C:\WINDOWS\Fonts True C:\Windows\Fonts
21 &H15 CSIDL_TEMPLATES ssfTEMPLATES C:\Users\Username\AppData\Roaming\Microsoft\Windows\Templates True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Templates
22 &H16 CSIDL_COMMON_STARTMENU ssfCOMMONSTARTMENU C:\ProgramData\Microsoft\Windows\Start Menu True C:\ProgramData\Microsoft\Windows\Start Menu
23 &H17 CSIDL_COMMON_PROGRAMS ssfCOMMONPROGRAMS C:\ProgramData\Microsoft\Windows\Start Menu\Programs True C:\ProgramData\Microsoft\Windows\Start Menu\Programs
24 &H18 CSIDL_COMMON_STARTUP ssfCOMMONSTARTUP C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup True C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
25 &H19 CSIDL_COMMON_DESKTOPDIRECTORY ssfCOMMONDESKTOPDIR C:\Users\Public\Desktop True C:\Users\Public\Desktop
26 &H1A CSIDL_APPDATA ssfAPPDATA C:\Users\Username\AppData\Roaming True C:\Users\Username\AppData\Roaming
27 &H1B CSIDL_PRINTHOOD ssfPRINTHOOD C:\Users\Username\AppData\Roaming\Microsoft\Windows\Printer Shortcuts True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
28 &H1C CSIDL_LOCAL_APPDATA ssfLOCALAPPDATA C:\Users\Username\AppData\Local True C:\Users\Username\AppData\Local
29 &H1D CSIDL_ALTSTARTUP ssfALTSTARTUP C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
30 &H1E CSIDL_COMMON_ALTSTARTUP ssfCOMMONALTSTARTUP C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup True C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
31 &H1F CSIDL_COMMON_FAVORITES ssfCOMMONFAVORITES C:\Users\Username\Favorites True C:\Users\Username\Favorites
32 &H20 CSIDL_INTERNET_CACHE ssfINTERNETCACHE C:\Users\Username\AppData\Local\Microsoft\Windows\INetCache True C:\Users\Username\AppData\Local\Microsoft\Windows\INetCache
33 &H21 CSIDL_COOKIES ssfCOOKIES C:\Users\Username\AppData\Local\Microsoft\Windows\INetCookies True C:\Users\Username\AppData\Local\Microsoft\Windows\INetCookies
34 &H22 CSIDL_HISTORY ssfHISTORY C:\Users\Username\AppData\Local\Microsoft\Windows\History True C:\Users\Username\AppData\Local\Microsoft\Windows\History
35 &H23 CSIDL_COMMON_APPDATA ssfCOMMONAPPDATA C:\ProgramData True C:\ProgramData
36 &H24 CSIDL_WINDOWS ssfWINDOWS C:\WINDOWS True C:\Windows
37 &H25 CSIDL_SYSTEM ssfSYSTEM C:\WINDOWS\system32 True C:\Windows\System32
38 &H26 CSIDL_PROGRAM_FILES ssfPROGRAMFILES C:\Program Files True C:\Program Files
39 &H27 CSIDL_MYPICTURES ssfMYPICTURES C:\Users\Username\Pictures True C:\Users\Username\Pictures
40 &H28 CSIDL_PROFILE ssfPROFILE C:\Users\Username True C:\Users\Username
41 &H29 ssfSYSTEMx86 C:\WINDOWS\SysWOW64 True C:\Windows\SysWOW64
42 &H2A ssfPROGRAMFILESx86 C:\Program Files (x86) True C:\Program Files (x86)
43 &H2B CSIDL_PROGRAM_FILES_COMMON C:\Program Files\Common Files True C:\Program Files\Common Files
44 &H2C C:\Program Files (x86)\Common Files True C:\Program Files (x86)\Common Files
45 &H2D CSIDL_COMMON_TEMPLATES C:\ProgramData\Microsoft\Windows\Templates True C:\ProgramData\Microsoft\Windows\Templates
46 &H2E CSIDL_COMMON_DOCUMENTS C:\Users\Public\Documents True C:\Users\Public\Documents
47 &H2F CSIDL_COMMON_ADMINTOOLS C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools True C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
48 &H30 CSIDL_ADMINTOOLS C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools True C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
49 &H31 False ::{21EC2020-3AEA-1069-A2DD-08002B30309D}::{7007ACC7-3202-11D1-AAD2-00805FC1270E}
50 &H32 True
51 &H33 True
52 &H34 True
53 &H35 CSIDL_COMMON_MUSIC C:\Users\Public\Music True C:\Users\Public\Music
54 &H36 CSIDL_COMMON_PICTURES C:\Users\Public\Pictures True C:\Users\Public\Pictures
55 &H37 CSIDL_COMMON_VIDEO C:\Users\Public\Videos True C:\Users\Public\Videos
56 &H38 C:\WINDOWS\resources True C:\Windows\Resources
57 &H39 True
58 &H3A C:\ProgramData\OEM Links True C:\ProgramData\OEM Links
59 &H3B CSIDL_CDBURN_AREA C:\Users\Username\AppData\Local\Microsoft\Windows\Burn\Burn True C:\Users\Username\AppData\Local\Microsoft\Windows\Burn\Burn
60 &H3C True
61 &H3D False ::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}
62 &H3E CSIDL_PROFILES True
63 &H3F True

You can generate this table for your own PC using the following code:

Option Explicit

#If VBA7 Then
    Private Declare PtrSafe Function SHGetFolderPath Lib "shell32.dll" Alias "SHGetFolderPathA" (ByVal hWnd As Long, ByVal nFolder As Long, ByVal hToken As Long, ByVal dwFlags As Long, ByVal pszPath As String) As Long
#Else
    Private Declare Function SHGetFolderPath Lib "shell32.dll" Alias "SHGetFolderPathA" (ByVal hwnd As Long, ByVal nFolder As Long, ByVal hToken As Long, ByVal dwFlags As Long, ByVal pszPath As String) As Long
#End If

'Call this Sub to generate the table of all possible outputs in your debug window
Private Sub GenerateListOfAllPossibleOutputs()
    Dim MAX_LEN_PATH As Long
    MAX_LEN_PATH = Len(GetFolderPathByCSIDL(CSIDL_ADMINTOOLS))
        Debug.Print "Decimal", "Hex", _
        MakeStrLen("CSIDL code name", 41), _
        MakeStrLen("ssfC code name", 27), _
        MakeStrLen("Path or location (GetFolderPathByCSIDL)", MAX_LEN_PATH), _
        "Equal?", _
        MakeStrLen("Path or location (GetFolderPathBySSFC)", MAX_LEN_PATH)
    Dim AllCSIDLs As Object
    Set AllCSIDLs = GetAllCSIDLs
    Dim AllssfCs As Object
    Set AllssfCs = GetAllssfCs
    Dim i As Long
    For i = 0 To 63
        Debug.Print i, "&H" & Hex(i) & "&", _
                    MakeStrLen(AllCSIDLs(i), 41), _
                    MakeStrLen(AllssfCs(i), 27), _
                    MakeStrLen(GetFolderPathByCSIDL(i), MAX_LEN_PATH), _
                    IIf(LCase(GetFolderPathByCSIDL(i)) = _
                    LCase(GetFolderPathBySSFC(i)), "True", "False"), _
                    MakeStrLen(GetFolderPathBySSFC(i), MAX_LEN_PATH)
    Next i
End Sub

'Function used to query SHGetFolderPathA
Public Function GetFolderPathByCSIDL(ByVal FolderCSIDL As Long) As String
    Const MAX_PATH As Long = 260
    Const S_OK As Long = &H0
    Dim path As String: path = String(MAX_PATH, vbNullChar)
    
    If SHGetFolderPath(0, FolderCSIDL, 0, 0, path) = S_OK Then
        GetFolderPathByCSIDL = Left(path, InStr(path, vbNullChar) - 1)
    End If
End Function

'Function used to query oShell.NameSpace().Self.Path
Public Function GetFolderPathBySSFC(ByVal ssfC As Long)
    Dim oShell As Object
    Set oShell = CreateObject("Shell.Application")
    
    If Not oShell.NameSpace(CVar(ssfC)) Is Nothing Then
        GetFolderPathBySSFC = oShell.NameSpace(CVar(ssfC)).Self.path
    End If
End Function

Public Function MakeStrLen(ByVal str As String, length As Long, _
                           Optional fillerChar As String = " ") As String
    If length > Len(str) Then
        MakeStrLen = str & String(length - Len(str), fillerChar)
    Else
        MakeStrLen = Left(str, length)
    End If
End Function

Private Function GetAllssfCs() As Object
    Set GetAllssfCs = CreateObject("Scripting.Dictionary")
    With GetAllssfCs
        .Add Key:=&H0&, Item:="ssfDESKTOP"
        .Add Key:=&H2&, Item:="ssfPROGRAMS"
        .Add Key:=&H3&, Item:="ssfCONTROLS"
        .Add Key:=&H4&, Item:="ssfPRINTERS"
        .Add Key:=&H5&, Item:="ssfPERSONAL"
        .Add Key:=&H6&, Item:="ssfFAVORITES"
        .Add Key:=&H7&, Item:="ssfSTARTUP"
        .Add Key:=&H8&, Item:="ssfRECENT"
        .Add Key:=&H9&, Item:="ssfSENDTO"
        .Add Key:=&HA&, Item:="ssfBITBUCKET"
        .Add Key:=&HB&, Item:="ssfSTARTMENU"
        .Add Key:=&H10&, Item:="ssfDESKTOPDIRECTORY"
        .Add Key:=&H11&, Item:="ssfDRIVES"
        .Add Key:=&H12&, Item:="ssfNETWORK"
        .Add Key:=&H13&, Item:="ssfNETHOOD"
        .Add Key:=&H14&, Item:="ssfFONTS"
        .Add Key:=&H15&, Item:="ssfTEMPLATES"
        .Add Key:=&H16&, Item:="ssfCOMMONSTARTMENU"
        .Add Key:=&H17&, Item:="ssfCOMMONPROGRAMS"
        .Add Key:=&H18&, Item:="ssfCOMMONSTARTUP"
        .Add Key:=&H19&, Item:="ssfCOMMONDESKTOPDIR"
        .Add Key:=&H1A&, Item:="ssfAPPDATA"
        .Add Key:=&H1B&, Item:="ssfPRINTHOOD"
        .Add Key:=&H1C&, Item:="ssfLOCALAPPDATA"
        .Add Key:=&H1D&, Item:="ssfALTSTARTUP"
        .Add Key:=&H1E&, Item:="ssfCOMMONALTSTARTUP"
        .Add Key:=&H1F&, Item:="ssfCOMMONFAVORITES"
        .Add Key:=&H20&, Item:="ssfINTERNETCACHE"
        .Add Key:=&H21&, Item:="ssfCOOKIES"
        .Add Key:=&H22&, Item:="ssfHISTORY"
        .Add Key:=&H23&, Item:="ssfCOMMONAPPDATA"
        .Add Key:=&H24&, Item:="ssfWINDOWS"
        .Add Key:=&H25&, Item:="ssfSYSTEM"
        .Add Key:=&H26&, Item:="ssfPROGRAMFILES"
        .Add Key:=&H27&, Item:="ssfMYPICTURES"
        .Add Key:=&H28&, Item:="ssfPROFILE"
        .Add Key:=&H29&, Item:="ssfSYSTEMx86"
        .Add Key:=&H2A&, Item:="ssfPROGRAMFILESx86"
    End With
End Function

Private Function GetAllCSIDLs() As Object
    Set GetAllCSIDLs = CreateObject("Scripting.Dictionary")
    With GetAllCSIDLs
        .Add Key:=&H0&, Item:="CSIDL_DESKTOP"
        .Add Key:=&H1&, Item:="CSIDL_INTERNET"
        .Add Key:=&H2&, Item:="CSIDL_PROGRAMS"
        .Add Key:=&H3&, Item:="CSIDL_CONTROLS"
        .Add Key:=&H4&, Item:="CSIDL_PRINTERS"
        .Add Key:=&H5&, Item:="CSIDL_PERSONAL"
        .Add Key:=&H6&, Item:="CSIDL_FAVORITES"
        .Add Key:=&H7&, Item:="CSIDL_STARTUP"
        .Add Key:=&H8&, Item:="CSIDL_RECENT"
        .Add Key:=&H9&, Item:="CSIDL_SENDTO"
        .Add Key:=&HA&, Item:="CSIDL_BITBUCKET"
        .Add Key:=&HB&, Item:="CSIDL_STARTMENU"
        .Add Key:=&HC&, Item:="CSIDL_MYDOCUMENTS"
        .Add Key:=&HD&, Item:="CSIDL_MYMUSIC"
        .Add Key:=&HE&, Item:="CSIDL_MYVIDEO"
        .Add Key:=&H10&, Item:="CSIDL_DESKTOPDIRECTORY"
        .Add Key:=&H11&, Item:="CSIDL_DRIVES"
        .Add Key:=&H12&, Item:="CSIDL_NETWORK"
        .Add Key:=&H13&, Item:="CSIDL_NETHOOD"
        .Add Key:=&H14&, Item:="CSIDL_FONTS"
        .Add Key:=&H15&, Item:="CSIDL_TEMPLATES"
        .Add Key:=&H16&, Item:="CSIDL_COMMON_STARTMENU"
        .Add Key:=&H17&, Item:="CSIDL_COMMON_PROGRAMS"
        .Add Key:=&H18&, Item:="CSIDL_COMMON_STARTUP"
        .Add Key:=&H19&, Item:="CSIDL_COMMON_DESKTOPDIRECTORY"
        .Add Key:=&H1A&, Item:="CSIDL_APPDATA"
        .Add Key:=&H1B&, Item:="CSIDL_PRINTHOOD"
        .Add Key:=&H1C&, Item:="CSIDL_LOCAL_APPDATA"
        .Add Key:=&H1D&, Item:="CSIDL_ALTSTARTUP"
        .Add Key:=&H1E&, Item:="CSIDL_COMMON_ALTSTARTUP"
        .Add Key:=&H1F&, Item:="CSIDL_COMMON_FAVORITES"
        .Add Key:=&H20&, Item:="CSIDL_INTERNET_CACHE"
        .Add Key:=&H21&, Item:="CSIDL_COOKIES"
        .Add Key:=&H22&, Item:="CSIDL_HISTORY"
        .Add Key:=&H23&, Item:="CSIDL_COMMON_APPDATA"
        .Add Key:=&H24&, Item:="CSIDL_WINDOWS"
        .Add Key:=&H25&, Item:="CSIDL_SYSTEM"
        .Add Key:=&H26&, Item:="CSIDL_PROGRAM_FILES"
        .Add Key:=&H27&, Item:="CSIDL_MYPICTURES"
        .Add Key:=&H28&, Item:="CSIDL_PROFILE"
        .Add Key:=&H2B&, Item:="CSIDL_PROGRAM_FILES_COMMON"
        .Add Key:=&H2D&, Item:="CSIDL_COMMON_TEMPLATES"
        .Add Key:=&H2E&, Item:="CSIDL_COMMON_DOCUMENTS"
        .Add Key:=&H2F&, Item:="CSIDL_COMMON_ADMINTOOLS"
        .Add Key:=&H30&, Item:="CSIDL_ADMINTOOLS"
        .Add Key:=&H35&, Item:="CSIDL_COMMON_MUSIC"
        .Add Key:=&H36&, Item:="CSIDL_COMMON_PICTURES"
        .Add Key:=&H37&, Item:="CSIDL_COMMON_VIDEO"
        .Add Key:=&H3B&, Item:="CSIDL_CDBURN_AREA"
        .Add Key:=&H3E&, Item:="CSIDL_PROFILES"
    End With
End Function

Declarations of Shell Special Folder Constants for VBA

'List of Shell Special Folder Constants, declarations for VBA
'Source: ShlDisp.h (Windows 11 SDK 10.0.22621.0) (sorted alphabetically)

'Example paths and a comparison with CSIDL can be found under this link:
'https://gist.github.com/guwidoe/43016947dad44457e4a90112ce32a4cf#file-csidl_ssfc_comparison-md

Const ssfALTSTARTUP = &H1d
Const ssfAPPDATA = &H1a
Const ssfBITBUCKET = &Ha
Const ssfCOMMONALTSTARTUP = &H1e
Const ssfCOMMONAPPDATA = &H23
Const ssfCOMMONDESKTOPDIR = &H19
Const ssfCOMMONFAVORITES = &H1f
Const ssfCOMMONPROGRAMS = &H17
Const ssfCOMMONSTARTMENU = &H16
Const ssfCOMMONSTARTUP = &H18
Const ssfCONTROLS = &H3
Const ssfCOOKIES = &H21
Const ssfDESKTOP = &H0
Const ssfDESKTOPDIRECTORY = &H10
Const ssfDRIVES = &H11
Const ssfFAVORITES = &H6
Const ssfFONTS = &H14
Const ssfHISTORY = &H22
Const ssfINTERNETCACHE = &H20
Const ssfLOCALAPPDATA = &H1c
Const ssfMYPICTURES = &H27
Const ssfNETHOOD = &H13
Const ssfNETWORK = &H12
Const ssfPERSONAL = &H5
Const ssfPRINTERS = &H4
Const ssfPRINTHOOD = &H1b
Const ssfPROFILE = &H28
Const ssfPROGRAMFILES = &H26
Const ssfPROGRAMFILESx86 = &H2A 'This constant is wrongly set as &H30 in ShlDisp.h!
Const ssfPROGRAMS = &H2
Const ssfRECENT = &H8
Const ssfSENDTO = &H9
Const ssfSTARTMENU = &Hb
Const ssfSTARTUP = &H7
Const ssfSYSTEM = &H25
Const ssfSYSTEMx86 = &H29
Const ssfTEMPLATES = &H15
Const ssfWINDOWS = &H24

Declarations of CSIDLs for VBA

'List of CSIDLs, declarations for VBA
'Source: Shlobj.h

'Example paths and a comparison with ssfCs (Shell Special Folder Constants) 
'can be found under this link:
'https://gist.github.com/guwidoe/43016947dad44457e4a90112ce32a4cf#file-csidl_ssfc_comparison-md

Const CSIDL_ADMINTOOLS = &H30
Const CSIDL_ALTSTARTUP = &H1D
Const CSIDL_APPDATA = &H1A
Const CSIDL_BITBUCKET = &HA
Const CSIDL_CDBURN_AREA = &H3B
Const CSIDL_COMMON_ADMINTOOLS = &H2F
Const CSIDL_COMMON_ALTSTARTUP = &H1E
Const CSIDL_COMMON_APPDATA = &H23
Const CSIDL_COMMON_DESKTOPDIRECTORY = &H19
Const CSIDL_COMMON_DOCUMENTS = &H2E
Const CSIDL_COMMON_FAVORITES = &H1F
Const CSIDL_COMMON_MUSIC = &H35
Const CSIDL_COMMON_PICTURES = &H36
Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_COMMON_STARTMENU = &H16
Const CSIDL_COMMON_STARTUP = &H18
Const CSIDL_COMMON_TEMPLATES = &H2D
Const CSIDL_COMMON_VIDEO = &H37
Const CSIDL_CONTROLS = &H3
Const CSIDL_COOKIES = &H21
Const CSIDL_DESKTOP = &H0
Const CSIDL_DESKTOPDIRECTORY = &H10
Const CSIDL_DRIVES = &H11
Const CSIDL_FAVORITES = &H6
Const CSIDL_FONTS = &H14
Const CSIDL_HISTORY = &H22
Const CSIDL_INTERNET = &H1
Const CSIDL_INTERNET_CACHE = &H20
Const CSIDL_LOCAL_APPDATA = &H1C
Const CSIDL_MYDOCUMENTS = &HC
Const CSIDL_MYMUSIC = &HD
Const CSIDL_MYPICTURES = &H27
Const CSIDL_MYVIDEO = &HE
Const CSIDL_NETHOOD = &H13
Const CSIDL_NETWORK = &H12
Const CSIDL_PERSONAL = &H5
Const CSIDL_PRINTERS = &H4
Const CSIDL_PRINTHOOD = &H1B
Const CSIDL_PROFILE = &H28
Const CSIDL_PROFILES = &H3E
Const CSIDL_PROGRAM_FILES = &H26
Const CSIDL_PROGRAM_FILES_COMMON = &H2B
Const CSIDL_PROGRAMS = &H2
Const CSIDL_RECENT = &H8
Const CSIDL_SENDTO = &H9
Const CSIDL_STARTMENU = &HB
Const CSIDL_STARTUP = &H7
Const CSIDL_SYSTEM = &H25
Const CSIDL_TEMPLATES = &H15
Const CSIDL_WINDOWS = &H24

Table providing example paths for standard KnownFolderIDs

Code to generate this table for your own pc is provided below.

KnownFolderID (CodeName) Example Path
FOLDERID_AccountPictures C:\Users\Username\AppData\Roaming\Microsoft\Windows\AccountPictures
FOLDERID_AddNewPrograms
FOLDERID_AdminTools C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools
FOLDERID_AllAppMods
FOLDERID_AppCaptures C:\Users\Username\Videos\Captures
FOLDERID_AppDataDesktop
FOLDERID_AppDataDocuments
FOLDERID_AppDataFavorites
FOLDERID_AppDataProgramData
FOLDERID_ApplicationShortcuts C:\Users\Username\AppData\Local\Microsoft\Windows\Application Shortcuts
FOLDERID_AppsFolder
FOLDERID_AppUpdates
FOLDERID_CameraRoll C:\Users\Username\Pictures\Camera Roll
FOLDERID_CameraRollLibrary C:\Users\Username\AppData\Roaming\Microsoft\Windows\Libraries\CameraRoll.library-ms
FOLDERID_CDBurning C:\Users\Username\AppData\Local\Microsoft\Windows\Burn\Burn
FOLDERID_ChangeRemovePrograms
FOLDERID_CommonAdminTools C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools
FOLDERID_CommonOEMLinks C:\ProgramData\OEM Links
FOLDERID_CommonPrograms C:\ProgramData\Microsoft\Windows\Start Menu\Programs
FOLDERID_CommonStartMenu C:\ProgramData\Microsoft\Windows\Start Menu
FOLDERID_CommonStartMenuPlaces
FOLDERID_CommonStartup C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
FOLDERID_CommonTemplates C:\ProgramData\Microsoft\Windows\Templates
FOLDERID_ComputerFolder
FOLDERID_ConflictFolder
FOLDERID_ConnectionsFolder
FOLDERID_Contacts C:\Users\Username\Contacts
FOLDERID_ControlPanelFolder
FOLDERID_Cookies C:\Users\Username\AppData\Local\Microsoft\Windows\INetCookies
FOLDERID_CurrentAppMods
FOLDERID_Desktop C:\Users\Username\Desktop
FOLDERID_DevelopmentFiles
FOLDERID_Device
FOLDERID_DeviceMetadataStore C:\ProgramData\Microsoft\Windows\DeviceMetadataStore
FOLDERID_Documents C:\Users\Username\Documents
FOLDERID_DocumentsLibrary C:\Users\Username\AppData\Roaming\Microsoft\Windows\Libraries\Documents.library-ms
FOLDERID_Downloads C:\Users\Username\Downloads
FOLDERID_Favorites C:\Users\Username\Favorites
FOLDERID_Fonts C:\WINDOWS\Fonts
FOLDERID_Games
FOLDERID_GameTasks C:\Users\Username\AppData\Local\Microsoft\Windows\GameExplorer
FOLDERID_History C:\Users\Username\AppData\Local\Microsoft\Windows\History
FOLDERID_HomeGroup
FOLDERID_HomeGroupCurrentUser
FOLDERID_ImplicitAppShortcuts C:\Users\Username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\ImplicitAppShortcuts
FOLDERID_InternetCache C:\Users\Username\AppData\Local\Microsoft\Windows\INetCache
FOLDERID_InternetFolder
FOLDERID_Libraries C:\Users\Username\AppData\Roaming\Microsoft\Windows\Libraries
FOLDERID_Links C:\Users\Username\Links
FOLDERID_LocalAppData C:\Users\Username\AppData\Local
FOLDERID_LocalAppDataLow C:\Users\Username\AppData\LocalLow
FOLDERID_LocalDocuments C:\Users\Username\Documents
FOLDERID_LocalDownloads C:\Users\Username\Downloads
FOLDERID_LocalizedResourcesDir
FOLDERID_LocalMusic C:\Users\Username\Music
FOLDERID_LocalPictures C:\Users\Username\Pictures
FOLDERID_LocalStorage
FOLDERID_LocalVideos C:\Users\Username\Videos
FOLDERID_Music C:\Users\Username\Music
FOLDERID_MusicLibrary C:\Users\Username\AppData\Roaming\Microsoft\Windows\Libraries\Music.library-ms
FOLDERID_NetHood C:\Users\Username\AppData\Roaming\Microsoft\Windows\Network Shortcuts
FOLDERID_NetworkFolder
FOLDERID_Objects3D
FOLDERID_OneDrive C:\Users\Username\OneDrive
FOLDERID_OriginalImages
FOLDERID_PhotoAlbums
FOLDERID_Pictures C:\Users\Username\Pictures
FOLDERID_PicturesLibrary C:\Users\Username\AppData\Roaming\Microsoft\Windows\Libraries\Pictures.library-ms
FOLDERID_Playlists
FOLDERID_PrintersFolder
FOLDERID_PrintHood C:\Users\Username\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
FOLDERID_Profile C:\Users\Username
FOLDERID_ProgramData C:\ProgramData
FOLDERID_ProgramFiles C:\Program Files
FOLDERID_ProgramFilesCommon C:\Program Files\Common Files
FOLDERID_ProgramFilesCommonX64 C:\Program Files\Common Files
FOLDERID_ProgramFilesCommonX86 C:\Program Files (x86)\Common Files
FOLDERID_ProgramFilesX64 C:\Program Files
FOLDERID_ProgramFilesX86 C:\Program Files (x86)
FOLDERID_Programs C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
FOLDERID_Public C:\Users\Public
FOLDERID_PublicDesktop C:\Users\Public\Desktop
FOLDERID_PublicDocuments C:\Users\Public\Documents
FOLDERID_PublicDownloads C:\Users\Public\Downloads
FOLDERID_PublicGameTasks C:\ProgramData\Microsoft\Windows\GameExplorer
FOLDERID_PublicLibraries C:\Users\Public\Libraries
FOLDERID_PublicMusic C:\Users\Public\Music
FOLDERID_PublicPictures C:\Users\Public\Pictures
FOLDERID_PublicRingtones C:\ProgramData\Microsoft\Windows\Ringtones
FOLDERID_PublicUserTiles C:\Users\Public\AccountPictures
FOLDERID_PublicVideos C:\Users\Public\Videos
FOLDERID_QuickLaunch C:\Users\Username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch
FOLDERID_Recent C:\Users\Username\AppData\Roaming\Microsoft\Windows\Recent
FOLDERID_RecordedCalls
FOLDERID_RecordedTVLibrary C:\Users\Public\Libraries\RecordedTV.library-ms
FOLDERID_RecycleBinFolder
FOLDERID_ResourceDir C:\WINDOWS\resources
FOLDERID_RetailDemo C:\ProgramData\Microsoft\Windows\RetailDemo
FOLDERID_Ringtones C:\Users\Username\AppData\Local\Microsoft\Windows\Ringtones
FOLDERID_RoamedTileImages
FOLDERID_RoamingAppData C:\Users\Username\AppData\Roaming
FOLDERID_RoamingTiles C:\Users\Username\AppData\Local\Microsoft\Windows\RoamingTiles
FOLDERID_SampleMusic
FOLDERID_SamplePictures
FOLDERID_SamplePlaylists
FOLDERID_SampleVideos
FOLDERID_SavedGames C:\Users\Username\Saved Games
FOLDERID_SavedPictures C:\Users\Username\Pictures\Saved Pictures
FOLDERID_SavedPicturesLibrary C:\Users\Username\AppData\Roaming\Microsoft\Windows\Libraries\SavedPictures.library-ms
FOLDERID_SavedSearches C:\Users\Username\Searches
FOLDERID_Screenshots C:\Users\Username\Pictures\Screenshots
FOLDERID_SEARCH_CSC
FOLDERID_SEARCH_MAPI
FOLDERID_SearchHistory
FOLDERID_SearchHome
FOLDERID_SearchTemplates
FOLDERID_SendTo C:\Users\Username\AppData\Roaming\Microsoft\Windows\SendTo
FOLDERID_SidebarDefaultParts
FOLDERID_SidebarParts
FOLDERID_SkyDrive C:\Users\Username\OneDrive
FOLDERID_SkyDriveCameraRoll
FOLDERID_SkyDriveDocuments C:\Users\Username\OneDrive\Documents
FOLDERID_SkyDriveMusic
FOLDERID_SkyDrivePictures C:\Users\Username\OneDrive\Bilder
FOLDERID_StartMenu C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu
FOLDERID_StartMenuAllPrograms
FOLDERID_Startup C:\Users\Username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
FOLDERID_SyncManagerFolder
FOLDERID_SyncResultsFolder
FOLDERID_SyncSetupFolder
FOLDERID_System C:\WINDOWS\system32
FOLDERID_SystemX86 C:\WINDOWS\SysWOW64
FOLDERID_Templates C:\Users\Username\AppData\Roaming\Microsoft\Windows\Templates
FOLDERID_UserPinned C:\Users\Username\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned
FOLDERID_UserProfiles C:\Users
FOLDERID_UserProgramFiles C:\Users\Username\AppData\Local\Programs
FOLDERID_UserProgramFilesCommon C:\Users\Username\AppData\Local\Programs\Common
FOLDERID_UsersFiles
FOLDERID_UsersLibraries
FOLDERID_Videos C:\Users\Username\Videos
FOLDERID_VideosLibrary C:\Users\Username\AppData\Roaming\Microsoft\Windows\Libraries\Videos.library-ms
FOLDERID_Windows C:\WINDOWS

To generate this table for your own pc, run the Sub GenerateTableOfKnownFolderIDsAndRespectivePaths in the following VBA code snippet, to get the output in the immediate window.

'Get any folders path by CLSID in VBA
'Authors:
'Original source from https://dbwiki.net/:
'    https://dbwiki.net/wiki/VBA_Tipp:_Spezielle_Verzeichnisse_ermitteln
'Adapted for VBA7 by Dietrich Baumgarten:
'    https://stackoverflow.com/a/62483749/12287457
'Further adapted for VBA6 and VBA7 compatibility by Guido Witt-Dörring:
'    https://stackoverflow.com/a/75102471/12287457

Option Explicit

#If VBA7 Then
    Private Declare PtrSafe Function SHGetKnownFolderPath Lib "Shell32" (ByRef rfid As GUID, ByVal dwFlags As Long, ByVal hToken As Long, ByRef pszPath As LongPtr) As Long
    Private Declare PtrSafe Function CLSIDFromString Lib "ole32" (ByVal lpszGuid As LongPtr, ByRef pGuid As GUID) As Long
    Private Declare PtrSafe Function lstrlenW Lib "kernel32" (ByVal lpString As LongPtr) As Long
    Private Declare PtrSafe Sub CoTaskMemFree Lib "ole32" (ByVal hMem As LongPtr)
    Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As LongPtr, ByVal Source As LongPtr, ByVal length As Long)
#Else
    Private Declare Function SHGetKnownFolderPath Lib "shell32" (rfid As Any, ByVal dwFlags As Long, ByVal hToken As Long, ppszPath As Long) As Long
    Private Declare Function CLSIDFromString Lib "ole32" (ByVal lpszGuid As Long, pGuid As Any) As Long
    Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
    Private Declare Sub CoTaskMemFree Lib "ole32" (ByVal pv As Long)
    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal length As Long)
#End If

Private Type GUID
    Data1 As Long
    Data2 As Integer
    Data3 As Integer
    Data4(7) As Byte
End Type

Sub GenerateTableOfKnownFolderIDsAndRespectivePaths()
    Dim allKnownFolderIDs As Object
    Set allKnownFolderIDs = GetAllStandardKnownFolderIDs
    
    Debug.Print MakeStrLen("KnownFolderID (CodeName)", 31), _
                MakeStrLen("KnownFolderID (GUID)", 31), "Example Path"
    
    Dim vKey As Variant, GUID As String, path As String
    For Each vKey In allKnownFolderIDs.Keys()
        GUID = UCase(allKnownFolderIDs(vKey))
        path = GetPathByKnownFolderID(GUID)
        Debug.Print MakeStrLen(vKey, 31), GUID, path
    Next vKey
End Sub

#If VBA7 Then
Private Function GetBstrFromWideStringPtr(ByVal lpwString As LongPtr) As String
#Else
Private Function GetBstrFromWideStringPtr(ByVal lpwString As Long) As String
#End If
    Dim length As Long
    If (lpwString) Then length = lstrlenW(lpwString)
    If (length) Then
        GetBstrFromWideStringPtr = Space$(length)
        CopyMemory StrPtr(GetBstrFromWideStringPtr), lpwString, length * 2
    End If
End Function

Public Function GetPathByKnownFolderID(ByVal KnownFolderID As String) As String
    Const S_OK As Long = &H0
    Const WIN32_NULL As Long = &H0
    Dim ref As GUID
    #If VBA7 Then
        Dim pszPath As LongPtr
    #Else
        Dim pszPath As Long
    #End If
    
    If (CLSIDFromString(StrPtr(KnownFolderID), ref) = S_OK) Then
        If (SHGetKnownFolderPath(ref, 0, WIN32_NULL, pszPath) = S_OK) Then
            GetPathByKnownFolderID = GetBstrFromWideStringPtr(pszPath)
            CoTaskMemFree pszPath
        End If
    End If
End Function

Private Function MakeStrLen(ByVal str As String, length As Long, _
                           Optional fillerChar As String = " ") As String
    If length > Len(str) Then
        MakeStrLen = str & String(length - Len(str), fillerChar)
    Else
        MakeStrLen = Left(str, length)
    End If
End Function

Private Function GetAllStandardKnownFolderIDs() As Object
    Set GetAllStandardKnownFolderIDs = CreateObject("Scripting.Dictionary")
    With GetAllStandardKnownFolderIDs
        'From KnownFolders.h (Windows 11 SDK 10.0.22621.0) (sorted alphabetically)
        .Add Key:="FOLDERID_AccountPictures", Item:="{008ca0b1-55b4-4c56-b8a8-4de4b299d3be}"
        .Add Key:="FOLDERID_AddNewPrograms", Item:="{de61d971-5ebc-4f02-a3a9-6c82895e5c04}"
        .Add Key:="FOLDERID_AdminTools", Item:="{724EF170-A42D-4FEF-9F26-B60E846FBA4F}"
        .Add Key:="FOLDERID_AllAppMods", Item:="{7ad67899-66af-43ba-9156-6aad42e6c596}"
        .Add Key:="FOLDERID_AppCaptures", Item:="{EDC0FE71-98D8-4F4A-B920-C8DC133CB165}"
        .Add Key:="FOLDERID_AppDataDesktop", Item:="{B2C5E279-7ADD-439F-B28C-C41FE1BBF672}"
        .Add Key:="FOLDERID_AppDataDocuments", Item:="{7BE16610-1F7F-44AC-BFF0-83E15F2FFCA1}"
        .Add Key:="FOLDERID_AppDataFavorites", Item:="{7CFBEFBC-DE1F-45AA-B843-A542AC536CC9}"
        .Add Key:="FOLDERID_AppDataProgramData", Item:="{559D40A3-A036-40FA-AF61-84CB430A4D34}"
        .Add Key:="FOLDERID_ApplicationShortcuts", Item:="{A3918781-E5F2-4890-B3D9-A7E54332328C}"
        .Add Key:="FOLDERID_AppsFolder", Item:="{1e87508d-89c2-42f0-8a7e-645a0f50ca58}"
        .Add Key:="FOLDERID_AppUpdates", Item:="{a305ce99-f527-492b-8b1a-7e76fa98d6e4}"
        .Add Key:="FOLDERID_CameraRoll", Item:="{AB5FB87B-7CE2-4F83-915D-550846C9537B}"
        .Add Key:="FOLDERID_CameraRollLibrary", Item:="{2B20DF75-1EDA-4039-8097-38798227D5B7}"
        .Add Key:="FOLDERID_CDBurning", Item:="{9E52AB10-F80D-49DF-ACB8-4330F5687855}"
        .Add Key:="FOLDERID_ChangeRemovePrograms", Item:="{df7266ac-9274-4867-8d55-3bd661de872d}"
        .Add Key:="FOLDERID_CommonAdminTools", Item:="{D0384E7D-BAC3-4797-8F14-CBA229B392B5}"
        .Add Key:="FOLDERID_CommonOEMLinks", Item:="{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}"
        .Add Key:="FOLDERID_CommonPrograms", Item:="{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}"
        .Add Key:="FOLDERID_CommonStartMenu", Item:="{A4115719-D62E-491D-AA7C-E74B8BE3B067}"
        .Add Key:="FOLDERID_CommonStartMenuPlaces", Item:="{A440879F-87A0-4F7D-B700-0207B966194A}"
        .Add Key:="FOLDERID_CommonStartup", Item:="{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}"
        .Add Key:="FOLDERID_CommonTemplates", Item:="{B94237E7-57AC-4347-9151-B08C6C32D1F7}"
        .Add Key:="FOLDERID_ComputerFolder", Item:="{0AC0837C-BBF8-452A-850D-79D08E667CA7}"
        .Add Key:="FOLDERID_ConflictFolder", Item:="{4bfefb45-347d-4006-a5be-ac0cb0567192}"
        .Add Key:="FOLDERID_ConnectionsFolder", Item:="{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"
        .Add Key:="FOLDERID_Contacts", Item:="{56784854-C6CB-462b-8169-88E350ACB882}"
        .Add Key:="FOLDERID_ControlPanelFolder", Item:="{82A74AEB-AEB4-465C-A014-D097EE346D63}"
        .Add Key:="FOLDERID_Cookies", Item:="{2B0F765D-C0E9-4171-908E-08A611B84FF6}"
        .Add Key:="FOLDERID_CurrentAppMods", Item:="{3db40b20-2a30-4dbe-917e-771dd21dd099}"
        .Add Key:="FOLDERID_Desktop", Item:="{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
        .Add Key:="FOLDERID_DevelopmentFiles", Item:="{DBE8E08E-3053-4BBC-B183-2A7B2B191E59}"
        .Add Key:="FOLDERID_Device", Item:="{1C2AC1DC-4358-4B6C-9733-AF21156576F0}"
        .Add Key:="FOLDERID_DeviceMetadataStore", Item:="{5CE4A5E9-E4EB-479D-B89F-130C02886155}"
        .Add Key:="FOLDERID_Documents", Item:="{FDD39AD0-238F-46AF-ADB4-6C85480369C7}"
        .Add Key:="FOLDERID_DocumentsLibrary", Item:="{7b0db17d-9cd2-4a93-9733-46cc89022e7c}"
        .Add Key:="FOLDERID_Downloads", Item:="{374DE290-123F-4565-9164-39C4925E467B}"
        .Add Key:="FOLDERID_Favorites", Item:="{1777F761-68AD-4D8A-87BD-30B759FA33DD}"
        .Add Key:="FOLDERID_Fonts", Item:="{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"
        .Add Key:="FOLDERID_Games", Item:="{CAC52C1A-B53D-4edc-92D7-6B2E8AC19434}"
        .Add Key:="FOLDERID_GameTasks", Item:="{054FAE61-4DD8-4787-80B6-090220C4B700}"
        .Add Key:="FOLDERID_History", Item:="{D9DC8A3B-B784-432E-A781-5A1130A75963}"
        .Add Key:="FOLDERID_HomeGroup", Item:="{52528A6B-B9E3-4add-B60D-588C2DBA842D}"
        .Add Key:="FOLDERID_HomeGroupCurrentUser", Item:="{9B74B6A3-0DFD-4f11-9E78-5F7800F2E772}"
        .Add Key:="FOLDERID_ImplicitAppShortcuts", Item:="{bcb5256f-79f6-4cee-b725-dc34e402fd46}"
        .Add Key:="FOLDERID_InternetCache", Item:="{352481E8-33BE-4251-BA85-6007CAEDCF9D}"
        .Add Key:="FOLDERID_InternetFolder", Item:="{4D9F7874-4E0C-4904-967B-40B0D20C3E4B}"
        .Add Key:="FOLDERID_Libraries", Item:="{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}"
        .Add Key:="FOLDERID_Links", Item:="{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}"
        .Add Key:="FOLDERID_LocalAppData", Item:="{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"
        .Add Key:="FOLDERID_LocalAppDataLow", Item:="{A520A1A4-1780-4FF6-BD18-167343C5AF16}"
        .Add Key:="FOLDERID_LocalDocuments", Item:="{f42ee2d3-909f-4907-8871-4c22fc0bf756}"
        .Add Key:="FOLDERID_LocalDownloads", Item:="{7d83ee9b-2244-4e70-b1f5-5393042af1e4}"
        .Add Key:="FOLDERID_LocalizedResourcesDir", Item:="{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}"
        .Add Key:="FOLDERID_LocalMusic", Item:="{a0c69a99-21c8-4671-8703-7934162fcf1d}"
        .Add Key:="FOLDERID_LocalPictures", Item:="{0ddd015d-b06c-45d5-8c4c-f59713854639}"
        .Add Key:="FOLDERID_LocalStorage", Item:="{B3EB08D3-A1F3-496B-865A-42B536CDA0EC}"
        .Add Key:="FOLDERID_LocalVideos", Item:="{35286a68-3c57-41a1-bbb1-0eae73d76c95}"
        .Add Key:="FOLDERID_Music", Item:="{4BD8D571-6D19-48D3-BE97-422220080E43}"
        .Add Key:="FOLDERID_MusicLibrary", Item:="{2112AB0A-C86A-4ffe-A368-0DE96E47012E}"
        .Add Key:="FOLDERID_NetHood", Item:="{C5ABBF53-E17F-4121-8900-86626FC2C973}"
        .Add Key:="FOLDERID_NetworkFolder", Item:="{D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}"
        .Add Key:="FOLDERID_Objects3D", Item:="{31C0DD25-9439-4F12-BF41-7FF4EDA38722}"
        .Add Key:="FOLDERID_OneDrive", Item:="{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
        .Add Key:="FOLDERID_OriginalImages", Item:="{2C36C0AA-5812-4b87-BFD0-4CD0DFB19B39}"
        .Add Key:="FOLDERID_PhotoAlbums", Item:="{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}"
        .Add Key:="FOLDERID_Pictures", Item:="{33E28130-4E1E-4676-835A-98395C3BC3BB}"
        .Add Key:="FOLDERID_PicturesLibrary", Item:="{A990AE9F-A03B-4e80-94BC-9912D7504104}"
        .Add Key:="FOLDERID_Playlists", Item:="{DE92C1C7-837F-4F69-A3BB-86E631204A23}"
        .Add Key:="FOLDERID_PrintersFolder", Item:="{76FC4E2D-D6AD-4519-A663-37BD56068185}"
        .Add Key:="FOLDERID_PrintHood", Item:="{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}"
        .Add Key:="FOLDERID_Profile", Item:="{5E6C858F-0E22-4760-9AFE-EA3317B67173}"
        .Add Key:="FOLDERID_ProgramData", Item:="{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"
        .Add Key:="FOLDERID_ProgramFiles", Item:="{905e63b6-c1bf-494e-b29c-65b732d3d21a}"
        .Add Key:="FOLDERID_ProgramFilesCommon", Item:="{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}"
        .Add Key:="FOLDERID_ProgramFilesCommonX64", Item:="{6365D5A7-0F0D-45e5-87F6-0DA56B6A4F7D}"
        .Add Key:="FOLDERID_ProgramFilesCommonX86", Item:="{DE974D24-D9C6-4D3E-BF91-F4455120B917}"
        .Add Key:="FOLDERID_ProgramFilesX64", Item:="{6D809377-6AF0-444b-8957-A3773F02200E}"
        .Add Key:="FOLDERID_ProgramFilesX86", Item:="{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
        .Add Key:="FOLDERID_Programs", Item:="{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"
        .Add Key:="FOLDERID_Public", Item:="{DFDF76A2-C82A-4D63-906A-5644AC457385}"
        .Add Key:="FOLDERID_PublicDesktop", Item:="{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}"
        .Add Key:="FOLDERID_PublicDocuments", Item:="{ED4824AF-DCE4-45A8-81E2-FC7965083634}"
        .Add Key:="FOLDERID_PublicDownloads", Item:="{3D644C9B-1FB8-4f30-9B45-F670235F79C0}"
        .Add Key:="FOLDERID_PublicGameTasks", Item:="{DEBF2536-E1A8-4c59-B6A2-414586476AEA}"
        .Add Key:="FOLDERID_PublicLibraries", Item:="{48daf80b-e6cf-4f4e-b800-0e69d84ee384}"
        .Add Key:="FOLDERID_PublicMusic", Item:="{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"
        .Add Key:="FOLDERID_PublicPictures", Item:="{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"
        .Add Key:="FOLDERID_PublicRingtones", Item:="{E555AB60-153B-4D17-9F04-A5FE99FC15EC}"
        .Add Key:="FOLDERID_PublicUserTiles", Item:="{0482af6c-08f1-4c34-8c90-e17ec98b1e17}"
        .Add Key:="FOLDERID_PublicVideos", Item:="{2400183A-6185-49FB-A2D8-4A392A602BA3}"
        .Add Key:="FOLDERID_QuickLaunch", Item:="{52a4f021-7b75-48a9-9f6b-4b87a210bc8f}"
        .Add Key:="FOLDERID_Recent", Item:="{AE50C081-EBD2-438A-8655-8A092E34987A}"
        .Add Key:="FOLDERID_RecordedCalls", Item:="{2f8b40c2-83ed-48ee-b383-a1f157ec6f9a}"
        .Add Key:="FOLDERID_RecordedTVLibrary", Item:="{1A6FDBA2-F42D-4358-A798-B74D745926C5}"
        .Add Key:="FOLDERID_RecycleBinFolder", Item:="{B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC}"
        .Add Key:="FOLDERID_ResourceDir", Item:="{8AD10C31-2ADB-4296-A8F7-E4701232C972}"
        .Add Key:="FOLDERID_RetailDemo", Item:="{12D4C69E-24AD-4923-BE19-31321C43A767}"
        .Add Key:="FOLDERID_Ringtones", Item:="{C870044B-F49E-4126-A9C3-B52A1FF411E8}"
        .Add Key:="FOLDERID_RoamedTileImages", Item:="{AAA8D5A5-F1D6-4259-BAA8-78E7EF60835E}"
        .Add Key:="FOLDERID_RoamingAppData", Item:="{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"
        .Add Key:="FOLDERID_RoamingTiles", Item:="{00BCFC5A-ED94-4e48-96A1-3F6217F21990}"
        .Add Key:="FOLDERID_SampleMusic", Item:="{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}"
        .Add Key:="FOLDERID_SamplePictures", Item:="{C4900540-2379-4C75-844B-64E6FAF8716B}"
        .Add Key:="FOLDERID_SamplePlaylists", Item:="{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}"
        .Add Key:="FOLDERID_SampleVideos", Item:="{859EAD94-2E85-48AD-A71A-0969CB56A6CD}"
        .Add Key:="FOLDERID_SavedGames", Item:="{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}"
        .Add Key:="FOLDERID_SavedPictures", Item:="{3B193882-D3AD-4eab-965A-69829D1FB59F}"
        .Add Key:="FOLDERID_SavedPicturesLibrary", Item:="{E25B5812-BE88-4bd9-94B0-29233477B6C3}"
        .Add Key:="FOLDERID_SavedSearches", Item:="{7d1d3a04-debb-4115-95cf-2f29da2920da}"
        .Add Key:="FOLDERID_Screenshots", Item:="{b7bede81-df94-4682-a7d8-57a52620b86f}"
        .Add Key:="FOLDERID_SEARCH_CSC", Item:="{ee32e446-31ca-4aba-814f-a5ebd2fd6d5e}"
        .Add Key:="FOLDERID_SEARCH_MAPI", Item:="{98ec0e18-2098-4d44-8644-66979315a281}"
        .Add Key:="FOLDERID_SearchHistory", Item:="{0D4C3DB6-03A3-462F-A0E6-08924C41B5D4}"
        .Add Key:="FOLDERID_SearchHome", Item:="{190337d1-b8ca-4121-a639-6d472d16972a}"
        .Add Key:="FOLDERID_SearchTemplates", Item:="{7E636BFE-DFA9-4D5E-B456-D7B39851D8A9}"
        .Add Key:="FOLDERID_SendTo", Item:="{8983036C-27C0-404B-8F08-102D10DCFD74}"
        .Add Key:="FOLDERID_SidebarDefaultParts", Item:="{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}"
        .Add Key:="FOLDERID_SidebarParts", Item:="{A75D362E-50FC-4fb7-AC2C-A8BEAA314493}"
        .Add Key:="FOLDERID_SkyDrive", Item:="{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
        .Add Key:="FOLDERID_SkyDriveCameraRoll", Item:="{767E6811-49CB-4273-87C2-20F355E1085B}"
        .Add Key:="FOLDERID_SkyDriveDocuments", Item:="{24D89E24-2F19-4534-9DDE-6A6671FBB8FE}"
        .Add Key:="FOLDERID_SkyDriveMusic", Item:="{C3F2459E-80D6-45DC-BFEF-1F769F2BE730}"
        .Add Key:="FOLDERID_SkyDrivePictures", Item:="{339719B5-8C47-4894-94C2-D8F77ADD44A6}"
        .Add Key:="FOLDERID_StartMenu", Item:="{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"
        .Add Key:="FOLDERID_StartMenuAllPrograms", Item:="{F26305EF-6948-40B9-B255-81453D09C785}"
        .Add Key:="FOLDERID_Startup", Item:="{B97D20BB-F46A-4C97-BA10-5E3608430854}"
        .Add Key:="FOLDERID_SyncManagerFolder", Item:="{43668BF8-C14E-49B2-97C9-747784D784B7}"
        .Add Key:="FOLDERID_SyncResultsFolder", Item:="{289a9a43-be44-4057-a41b-587a76d7e7f9}"
        .Add Key:="FOLDERID_SyncSetupFolder", Item:="{0F214138-B1D3-4a90-BBA9-27CBC0C5389A}"
        .Add Key:="FOLDERID_System", Item:="{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}"
        .Add Key:="FOLDERID_SystemX86", Item:="{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}"
        .Add Key:="FOLDERID_Templates", Item:="{A63293E8-664E-48DB-A079-DF759E0509F7}"
        .Add Key:="FOLDERID_UserPinned", Item:="{9e3995ab-1f9c-4f13-b827-48b24b6c7174}"
        .Add Key:="FOLDERID_UserProfiles", Item:="{0762D272-C50A-4BB0-A382-697DCD729B80}"
        .Add Key:="FOLDERID_UserProgramFiles", Item:="{5cd7aee2-2219-4a67-b85d-6c9ce15660cb}"
        .Add Key:="FOLDERID_UserProgramFilesCommon", Item:="{bcbd3057-ca5c-4622-b42d-bc56db0ae516}"
        .Add Key:="FOLDERID_UsersFiles", Item:="{f3ce0f7c-4901-4acc-8648-d5d44b04ef8f}"
        .Add Key:="FOLDERID_UsersLibraries", Item:="{A302545D-DEFF-464b-ABE8-61C8648D939B}"
        .Add Key:="FOLDERID_Videos", Item:="{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"
        .Add Key:="FOLDERID_VideosLibrary", Item:="{491E922F-5643-4af4-A7EB-4E7A138D8174}"
        .Add Key:="FOLDERID_Windows", Item:="{F38BF404-1D43-42F2-9305-67DE0B28FC23}"
    End With
End Function

Declaractions of KnownFolderIDs for VBA

'List of standard KnownFolderIDs, declarations for VBA
'Source: KnownFolders.h (Windows 11 SDK 10.0.22621.0) (sorted alphabetically)

Const FOLDERID_AccountPictures        As String = "{008ca0b1-55b4-4c56-b8a8-4de4b299d3be}"
Const FOLDERID_AddNewPrograms         As String = "{de61d971-5ebc-4f02-a3a9-6c82895e5c04}"
Const FOLDERID_AdminTools             As String = "{724EF170-A42D-4FEF-9F26-B60E846FBA4F}"
Const FOLDERID_AllAppMods             As String = "{7ad67899-66af-43ba-9156-6aad42e6c596}"
Const FOLDERID_AppCaptures            As String = "{EDC0FE71-98D8-4F4A-B920-C8DC133CB165}"
Const FOLDERID_AppDataDesktop         As String = "{B2C5E279-7ADD-439F-B28C-C41FE1BBF672}"
Const FOLDERID_AppDataDocuments       As String = "{7BE16610-1F7F-44AC-BFF0-83E15F2FFCA1}"
Const FOLDERID_AppDataFavorites       As String = "{7CFBEFBC-DE1F-45AA-B843-A542AC536CC9}"
Const FOLDERID_AppDataProgramData     As String = "{559D40A3-A036-40FA-AF61-84CB430A4D34}"
Const FOLDERID_ApplicationShortcuts   As String = "{A3918781-E5F2-4890-B3D9-A7E54332328C}"
Const FOLDERID_AppsFolder             As String = "{1e87508d-89c2-42f0-8a7e-645a0f50ca58}"
Const FOLDERID_AppUpdates             As String = "{a305ce99-f527-492b-8b1a-7e76fa98d6e4}"
Const FOLDERID_CameraRoll             As String = "{AB5FB87B-7CE2-4F83-915D-550846C9537B}"
Const FOLDERID_CameraRollLibrary      As String = "{2B20DF75-1EDA-4039-8097-38798227D5B7}"
Const FOLDERID_CDBurning              As String = "{9E52AB10-F80D-49DF-ACB8-4330F5687855}"
Const FOLDERID_ChangeRemovePrograms   As String = "{df7266ac-9274-4867-8d55-3bd661de872d}"
Const FOLDERID_CommonAdminTools       As String = "{D0384E7D-BAC3-4797-8F14-CBA229B392B5}"
Const FOLDERID_CommonOEMLinks         As String = "{C1BAE2D0-10DF-4334-BEDD-7AA20B227A9D}"
Const FOLDERID_CommonPrograms         As String = "{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8}"
Const FOLDERID_CommonStartMenu        As String = "{A4115719-D62E-491D-AA7C-E74B8BE3B067}"
Const FOLDERID_CommonStartMenuPlaces  As String = "{A440879F-87A0-4F7D-B700-0207B966194A}"
Const FOLDERID_CommonStartup          As String = "{82A5EA35-D9CD-47C5-9629-E15D2F714E6E}"
Const FOLDERID_CommonTemplates        As String = "{B94237E7-57AC-4347-9151-B08C6C32D1F7}"
Const FOLDERID_ComputerFolder         As String = "{0AC0837C-BBF8-452A-850D-79D08E667CA7}"
Const FOLDERID_ConflictFolder         As String = "{4bfefb45-347d-4006-a5be-ac0cb0567192}"
Const FOLDERID_ConnectionsFolder      As String = "{6F0CD92B-2E97-45D1-88FF-B0D186B8DEDD}"
Const FOLDERID_Contacts               As String = "{56784854-C6CB-462b-8169-88E350ACB882}"
Const FOLDERID_ControlPanelFolder     As String = "{82A74AEB-AEB4-465C-A014-D097EE346D63}"
Const FOLDERID_Cookies                As String = "{2B0F765D-C0E9-4171-908E-08A611B84FF6}"
Const FOLDERID_CurrentAppMods         As String = "{3db40b20-2a30-4dbe-917e-771dd21dd099}"
Const FOLDERID_Desktop                As String = "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}"
Const FOLDERID_DevelopmentFiles       As String = "{DBE8E08E-3053-4BBC-B183-2A7B2B191E59}"
Const FOLDERID_Device                 As String = "{1C2AC1DC-4358-4B6C-9733-AF21156576F0}"
Const FOLDERID_DeviceMetadataStore    As String = "{5CE4A5E9-E4EB-479D-B89F-130C02886155}"
Const FOLDERID_Documents              As String = "{FDD39AD0-238F-46AF-ADB4-6C85480369C7}"
Const FOLDERID_DocumentsLibrary       As String = "{7b0db17d-9cd2-4a93-9733-46cc89022e7c}"
Const FOLDERID_Downloads              As String = "{374DE290-123F-4565-9164-39C4925E467B}"
Const FOLDERID_Favorites              As String = "{1777F761-68AD-4D8A-87BD-30B759FA33DD}"
Const FOLDERID_Fonts                  As String = "{FD228CB7-AE11-4AE3-864C-16F3910AB8FE}"
Const FOLDERID_Games                  As String = "{CAC52C1A-B53D-4edc-92D7-6B2E8AC19434}"
Const FOLDERID_GameTasks              As String = "{054FAE61-4DD8-4787-80B6-090220C4B700}"
Const FOLDERID_History                As String = "{D9DC8A3B-B784-432E-A781-5A1130A75963}"
Const FOLDERID_HomeGroup              As String = "{52528A6B-B9E3-4add-B60D-588C2DBA842D}"
Const FOLDERID_HomeGroupCurrentUser   As String = "{9B74B6A3-0DFD-4f11-9E78-5F7800F2E772}"
Const FOLDERID_ImplicitAppShortcuts   As String = "{bcb5256f-79f6-4cee-b725-dc34e402fd46}"
Const FOLDERID_InternetCache          As String = "{352481E8-33BE-4251-BA85-6007CAEDCF9D}"
Const FOLDERID_InternetFolder         As String = "{4D9F7874-4E0C-4904-967B-40B0D20C3E4B}"
Const FOLDERID_Libraries              As String = "{1B3EA5DC-B587-4786-B4EF-BD1DC332AEAE}"
Const FOLDERID_Links                  As String = "{bfb9d5e0-c6a9-404c-b2b2-ae6db6af4968}"
Const FOLDERID_LocalAppData           As String = "{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}"
Const FOLDERID_LocalAppDataLow        As String = "{A520A1A4-1780-4FF6-BD18-167343C5AF16}"
Const FOLDERID_LocalDocuments         As String = "{f42ee2d3-909f-4907-8871-4c22fc0bf756}"
Const FOLDERID_LocalDownloads         As String = "{7d83ee9b-2244-4e70-b1f5-5393042af1e4}"
Const FOLDERID_LocalizedResourcesDir  As String = "{2A00375E-224C-49DE-B8D1-440DF7EF3DDC}"
Const FOLDERID_LocalMusic             As String = "{a0c69a99-21c8-4671-8703-7934162fcf1d}"
Const FOLDERID_LocalPictures          As String = "{0ddd015d-b06c-45d5-8c4c-f59713854639}"
Const FOLDERID_LocalStorage           As String = "{B3EB08D3-A1F3-496B-865A-42B536CDA0EC}"
Const FOLDERID_LocalVideos            As String = "{35286a68-3c57-41a1-bbb1-0eae73d76c95}"
Const FOLDERID_Music                  As String = "{4BD8D571-6D19-48D3-BE97-422220080E43}"
Const FOLDERID_MusicLibrary           As String = "{2112AB0A-C86A-4ffe-A368-0DE96E47012E}"
Const FOLDERID_NetHood                As String = "{C5ABBF53-E17F-4121-8900-86626FC2C973}"
Const FOLDERID_NetworkFolder          As String = "{D20BEEC4-5CA8-4905-AE3B-BF251EA09B53}"
Const FOLDERID_Objects3D              As String = "{31C0DD25-9439-4F12-BF41-7FF4EDA38722}"
Const FOLDERID_OneDrive               As String = "{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
Const FOLDERID_OriginalImages         As String = "{2C36C0AA-5812-4b87-BFD0-4CD0DFB19B39}"
Const FOLDERID_PhotoAlbums            As String = "{69D2CF90-FC33-4FB7-9A0C-EBB0F0FCB43C}"
Const FOLDERID_Pictures               As String = "{33E28130-4E1E-4676-835A-98395C3BC3BB}"
Const FOLDERID_PicturesLibrary        As String = "{A990AE9F-A03B-4e80-94BC-9912D7504104}"
Const FOLDERID_Playlists              As String = "{DE92C1C7-837F-4F69-A3BB-86E631204A23}"
Const FOLDERID_PrintersFolder         As String = "{76FC4E2D-D6AD-4519-A663-37BD56068185}"
Const FOLDERID_PrintHood              As String = "{9274BD8D-CFD1-41C3-B35E-B13F55A758F4}"
Const FOLDERID_Profile                As String = "{5E6C858F-0E22-4760-9AFE-EA3317B67173}"
Const FOLDERID_ProgramData            As String = "{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}"
Const FOLDERID_ProgramFiles           As String = "{905e63b6-c1bf-494e-b29c-65b732d3d21a}"
Const FOLDERID_ProgramFilesCommon     As String = "{F7F1ED05-9F6D-47A2-AAAE-29D317C6F066}"
Const FOLDERID_ProgramFilesCommonX64  As String = "{6365D5A7-0F0D-45e5-87F6-0DA56B6A4F7D}"
Const FOLDERID_ProgramFilesCommonX86  As String = "{DE974D24-D9C6-4D3E-BF91-F4455120B917}"
Const FOLDERID_ProgramFilesX64        As String = "{6D809377-6AF0-444b-8957-A3773F02200E}"
Const FOLDERID_ProgramFilesX86        As String = "{7C5A40EF-A0FB-4BFC-874A-C0F2E0B9FA8E}"
Const FOLDERID_Programs               As String = "{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}"
Const FOLDERID_Public                 As String = "{DFDF76A2-C82A-4D63-906A-5644AC457385}"
Const FOLDERID_PublicDesktop          As String = "{C4AA340D-F20F-4863-AFEF-F87EF2E6BA25}"
Const FOLDERID_PublicDocuments        As String = "{ED4824AF-DCE4-45A8-81E2-FC7965083634}"
Const FOLDERID_PublicDownloads        As String = "{3D644C9B-1FB8-4f30-9B45-F670235F79C0}"
Const FOLDERID_PublicGameTasks        As String = "{DEBF2536-E1A8-4c59-B6A2-414586476AEA}"
Const FOLDERID_PublicLibraries        As String = "{48daf80b-e6cf-4f4e-b800-0e69d84ee384}"
Const FOLDERID_PublicMusic            As String = "{3214FAB5-9757-4298-BB61-92A9DEAA44FF}"
Const FOLDERID_PublicPictures         As String = "{B6EBFB86-6907-413C-9AF7-4FC2ABF07CC5}"
Const FOLDERID_PublicRingtones        As String = "{E555AB60-153B-4D17-9F04-A5FE99FC15EC}"
Const FOLDERID_PublicUserTiles        As String = "{0482af6c-08f1-4c34-8c90-e17ec98b1e17}"
Const FOLDERID_PublicVideos           As String = "{2400183A-6185-49FB-A2D8-4A392A602BA3}"
Const FOLDERID_QuickLaunch            As String = "{52a4f021-7b75-48a9-9f6b-4b87a210bc8f}"
Const FOLDERID_Recent                 As String = "{AE50C081-EBD2-438A-8655-8A092E34987A}"
Const FOLDERID_RecordedCalls          As String = "{2f8b40c2-83ed-48ee-b383-a1f157ec6f9a}"
Const FOLDERID_RecordedTVLibrary      As String = "{1A6FDBA2-F42D-4358-A798-B74D745926C5}"
Const FOLDERID_RecycleBinFolder       As String = "{B7534046-3ECB-4C18-BE4E-64CD4CB7D6AC}"
Const FOLDERID_ResourceDir            As String = "{8AD10C31-2ADB-4296-A8F7-E4701232C972}"
Const FOLDERID_RetailDemo             As String = "{12D4C69E-24AD-4923-BE19-31321C43A767}"
Const FOLDERID_Ringtones              As String = "{C870044B-F49E-4126-A9C3-B52A1FF411E8}"
Const FOLDERID_RoamedTileImages       As String = "{AAA8D5A5-F1D6-4259-BAA8-78E7EF60835E}"
Const FOLDERID_RoamingAppData         As String = "{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}"
Const FOLDERID_RoamingTiles           As String = "{00BCFC5A-ED94-4e48-96A1-3F6217F21990}"
Const FOLDERID_SampleMusic            As String = "{B250C668-F57D-4EE1-A63C-290EE7D1AA1F}"
Const FOLDERID_SamplePictures         As String = "{C4900540-2379-4C75-844B-64E6FAF8716B}"
Const FOLDERID_SamplePlaylists        As String = "{15CA69B3-30EE-49C1-ACE1-6B5EC372AFB5}"
Const FOLDERID_SampleVideos           As String = "{859EAD94-2E85-48AD-A71A-0969CB56A6CD}"
Const FOLDERID_SavedGames             As String = "{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}"
Const FOLDERID_SavedPictures          As String = "{3B193882-D3AD-4eab-965A-69829D1FB59F}"
Const FOLDERID_SavedPicturesLibrary   As String = "{E25B5812-BE88-4bd9-94B0-29233477B6C3}"
Const FOLDERID_SavedSearches          As String = "{7d1d3a04-debb-4115-95cf-2f29da2920da}"
Const FOLDERID_Screenshots            As String = "{b7bede81-df94-4682-a7d8-57a52620b86f}"
Const FOLDERID_SEARCH_CSC             As String = "{ee32e446-31ca-4aba-814f-a5ebd2fd6d5e}"
Const FOLDERID_SEARCH_MAPI            As String = "{98ec0e18-2098-4d44-8644-66979315a281}"
Const FOLDERID_SearchHistory          As String = "{0D4C3DB6-03A3-462F-A0E6-08924C41B5D4}"
Const FOLDERID_SearchHome             As String = "{190337d1-b8ca-4121-a639-6d472d16972a}"
Const FOLDERID_SearchTemplates        As String = "{7E636BFE-DFA9-4D5E-B456-D7B39851D8A9}"
Const FOLDERID_SendTo                 As String = "{8983036C-27C0-404B-8F08-102D10DCFD74}"
Const FOLDERID_SidebarDefaultParts    As String = "{7B396E54-9EC5-4300-BE0A-2482EBAE1A26}"
Const FOLDERID_SidebarParts           As String = "{A75D362E-50FC-4fb7-AC2C-A8BEAA314493}"
Const FOLDERID_SkyDrive               As String = "{A52BBA46-E9E1-435f-B3D9-28DAA648C0F6}"
Const FOLDERID_SkyDriveCameraRoll     As String = "{767E6811-49CB-4273-87C2-20F355E1085B}"
Const FOLDERID_SkyDriveDocuments      As String = "{24D89E24-2F19-4534-9DDE-6A6671FBB8FE}"
Const FOLDERID_SkyDriveMusic          As String = "{C3F2459E-80D6-45DC-BFEF-1F769F2BE730}"
Const FOLDERID_SkyDrivePictures       As String = "{339719B5-8C47-4894-94C2-D8F77ADD44A6}"
Const FOLDERID_StartMenu              As String = "{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}"
Const FOLDERID_StartMenuAllPrograms   As String = "{F26305EF-6948-40B9-B255-81453D09C785}"
Const FOLDERID_Startup                As String = "{B97D20BB-F46A-4C97-BA10-5E3608430854}"
Const FOLDERID_SyncManagerFolder      As String = "{43668BF8-C14E-49B2-97C9-747784D784B7}"
Const FOLDERID_SyncResultsFolder      As String = "{289a9a43-be44-4057-a41b-587a76d7e7f9}"
Const FOLDERID_SyncSetupFolder        As String = "{0F214138-B1D3-4a90-BBA9-27CBC0C5389A}"
Const FOLDERID_System                 As String = "{1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}"
Const FOLDERID_SystemX86              As String = "{D65231B0-B2F1-4857-A4CE-A8E7C6EA7D27}"
Const FOLDERID_Templates              As String = "{A63293E8-664E-48DB-A079-DF759E0509F7}"
Const FOLDERID_UserPinned             As String = "{9e3995ab-1f9c-4f13-b827-48b24b6c7174}"
Const FOLDERID_UserProfiles           As String = "{0762D272-C50A-4BB0-A382-697DCD729B80}"
Const FOLDERID_UserProgramFiles       As String = "{5cd7aee2-2219-4a67-b85d-6c9ce15660cb}"
Const FOLDERID_UserProgramFilesCommon As String = "{bcbd3057-ca5c-4622-b42d-bc56db0ae516}"
Const FOLDERID_UsersFiles             As String = "{f3ce0f7c-4901-4acc-8648-d5d44b04ef8f}"
Const FOLDERID_UsersLibraries         As String = "{A302545D-DEFF-464b-ABE8-61C8648D939B}"
Const FOLDERID_Videos                 As String = "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}"
Const FOLDERID_VideosLibrary          As String = "{491E922F-5643-4af4-A7EB-4E7A138D8174}"
Const FOLDERID_Windows                As String = "{F38BF404-1D43-42F2-9305-67DE0B28FC23}"

Getting Special Folders on MacOS using VBA

The following code can be used to reliblay obtain special folder paths on MacOS

Public Function GetSpecialFolderMac(ByVal macSpecialFolderConstant As String, _
                           Optional ByVal domainName As String = "", _
                           Optional ByVal forceNonSandboxedPath As Boolean = True) _
                               As String
    Const methodName As String = "GetSpecialFolderMac"
    
    Select Case LCase$(domainName)
    Case "system", "local", "network", "user", "classic", "" 'Fine
    Case Else: Err.Raise 5, methodName, _
            "Invalid domain name passed to " & methodName & ": " & domainName _
            & vbLf & "Possible Domains are:" & vbLf & _
            "| DomainName| Location                                |" & vbLf & _
            "|-----------|-----------------------------------------|" & vbLf & _
            "| 'system'  | A folder in '/System/'                  |" & vbLf & _
            "| 'local'   | A folder in '/Library/'                 |" & vbLf & _
            "| 'network' | A folder in '/Network/'                 |" & vbLf & _
            "| 'user'    | A folder in '~' (the user’s home folder)|" & vbLf & _
            "| 'classic' | -||- in the Classic Mac OS system folder|" & vbLf & _
            "|           | (Only meaningful on systems that support Classic) |"
    End Select
            
    Dim domainStr As String
    domainStr = IIf(domainName = "", "", " from " & domainName & " domain")
    
    On Error Resume Next
    Dim app As Object:      Set app = Application
    Dim inExcel As Boolean: inExcel = (app.Name = "Microsoft Excel")
    On Error GoTo 0
    
    Dim cmd As String: cmd = "return POSIX path of (path to " & _
                            macSpecialFolderConstant & domainStr & ") as string"
    If inExcel Then 'In old excel v
        If Int(val(app.version)) <= 14 Then 'You run Mac Excel 2011, change cmd
            cmd = "return (path to " & macSpecialFolderConstant _
                                     & domainStr & ") as string"
        End If
    End If
    
    On Error GoTo PathDoesNotExist
    GetSpecialFolderMac = MacScript(cmd)
    On Error GoTo 0
    
    If forceNonSandboxedPath Then
        Dim sboxPath As String:  sboxPath = Environ("HOME")
        Dim sboxRelPath As String
        sboxRelPath = Mid(sboxPath, InStrRev(sboxPath, "/Library/Containers/"))
        
        GetSpecialFolderMac = Replace(GetSpecialFolderMac, _
                                      sboxRelPath, "", , 1, vbTextCompare)
    End If
    Exit Function
PathDoesNotExist:
    Err.Raise 5, methodName, _
        "Special folder '" & macSpecialFolderConstant & "' is not available" & _
        IIf(domainName = "", " or needs a specific domain.", _
                             " in the '" & domainName & "' domain.")
End Function

The following input parameters are valid:

'Special folder names for Mac
'Source:
'https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html
Private Const SFN_APPLICATION_SUPPORT     As String = "application support"
Private Const SFN_APPLICATIONS_FOLDER     As String = "applications folder"
Private Const SFN_DESKTOP                 As String = "desktop"
Private Const SFN_DESKTOP_PICTURES_FOLDER As String = "desktop pictures folder"
Private Const SFN_DOCUMENTS_FOLDER        As String = "documents folder"
Private Const SFN_DOWNLOADS_FOLDER        As String = "downloads folder"
Private Const SFN_FAVORITES_FOLDER        As String = "favorites folder"
Private Const SFN_FOLDER_ACTION_SCRIPTS   As String = "Folder Action scripts"
Private Const SFN_FONTS                   As String = "fonts"
Private Const SFN_HELP                    As String = "help"
Private Const SFN_HOME_FOLDER             As String = "home folder"
Private Const SFN_INTERNET_PLUGINS        As String = "internet plugins"
Private Const SFN_KEYCHAIN_FOLDER         As String = "keychain folder"
Private Const SFN_LIBRARY_FOLDER          As String = "library folder"
Private Const SFN_MODEM_SCRIPTS           As String = "modem scripts"
Private Const SFN_MOVIES_FOLDER           As String = "movies folder"
Private Const SFN_MUSIC_FOLDER            As String = "music folder"
Private Const SFN_PICTURES_FOLDER         As String = "pictures folder"
Private Const SFN_PREFERENCES             As String = "preferences"
Private Const SFN_PRINTER_DESCRIPTIONS    As String = "printer descriptions"
Private Const SFN_PUBLIC_FOLDER           As String = "public folder"
Private Const SFN_SCRIPTING_ADDITIONS     As String = "scripting additions"
Private Const SFN_SCRIPTS_FOLDER          As String = "scripts folder"
Private Const SFN_SERVICES_FOLDER         As String = "services folder"
Private Const SFN_SHARED_DOCUMENTS        As String = "shared documents"
Private Const SFN_SHARED_LIBRARIES        As String = "shared libraries"
Private Const SFN_SITES_FOLDER            As String = "sites folder"
Private Const SFN_STARTUP_DISK            As String = "startup disk"
Private Const SFN_STARTUP_ITEMS           As String = "startup items"
Private Const SFN_SYSTEM_FOLDER           As String = "system folder"
Private Const SFN_SYSTEM_PREFERENCES      As String = "system preferences"
Private Const SFN_TEMPORARY_ITEMS         As String = "temporary items"
Private Const SFN_TRASH                   As String = "trash"
Private Const SFN_USERS_FOLDER            As String = "users folder"
Private Const SFN_UTILITIES_FOLDER        As String = "utilities folder"
Private Const SFN_WORKFLOWS_FOLDER        As String = "workflows folder"
                                                  
'Classic domain only:
Private Const SFN_APPLE_MENU              As String = "apple menu"
Private Const SFN_CONTROL_PANELS          As String = "control panels"
Private Const SFN_CONTROL_STRIP_MODULES   As String = "control strip modules"
Private Const SFN_EXTENSIONS              As String = "extensions"
Private Const SFN_LAUNCHER_ITEMS_FOLDER   As String = "launcher items folder"
Private Const SFN_PRINTER_DRIVERS         As String = "printer drivers"
Private Const SFN_PRINTMONITOR            As String = "printmonitor"
Private Const SFN_SHUTDOWN_FOLDER         As String = "shutdown folder"
Private Const SFN_SPEAKABLE_ITEMS         As String = "speakable items"
Private Const SFN_STATIONERY              As String = "stationery"
Private Const SFN_VOICES                  As String = "voices"

'The following domain names are valid:
Private Const DOMAIN_SYSTEM  As String = "system"
Private Const DOMAIN_LOCAL   As String = "local"
Private Const DOMAIN_NETWORK As String = "network"
Private Const DOMAIN_USER    As String = "user"
Private Const DOMAIN_CLASSIC As String = "classic"

Examples for typical return values can be found in the following table:

Return Values of GetSpecialFolderMac for Various Input Parameters

The following paths were successfully returned:

Special Folder Constant Domain Example Folder Path (forceNonSandboxedPath = True) Example Folder Path (forceNonSandboxedPath = False)
application support local /Library/Application Support/ /Library/Application Support/
application support user /Users/username/Library/Application Support/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Application Support/
application support /Library/Application Support/ /Library/Application Support/
applications folder system /Applications/ /Applications/
applications folder local /Applications/ /Applications/
applications folder user /Users/username/Applications/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Applications/
applications folder /Applications/ /Applications/
desktop user /Users/username/Desktop/ /Users/username/Desktop/
desktop /Users/username/Desktop/ /Users/username/Desktop/
desktop pictures folder system /System/Library/Desktop Pictures/ /System/Library/Desktop Pictures/
desktop pictures folder user /Users/username/Library/Desktop Pictures/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Desktop Pictures/
documents folder user /Users/username/Documents/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Documents/
documents folder /Users/username/Documents/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Documents/
downloads folder user /Users/username/Downloads/ /Users/username/Downloads/
downloads folder /Users/username/Downloads/ /Users/username/Downloads/
favorites folder user /Users/username/Library/Favorites/ /Users/username/Library/Favorites/
favorites folder /Users/username/Library/Favorites/ /Users/username/Library/Favorites/
Folder Action scripts local /Library/Scripts/Folder Action Scripts/ /Library/Scripts/Folder Action Scripts/
Folder Action scripts user /Users/username/Library/Scripts/Folder Action Scripts/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Scripts/Folder Action Scripts/
Folder Action scripts /Users/username/Library/Scripts/Folder Action Scripts/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Scripts/Folder Action Scripts/
help /Applications/Microsoft Excel.app/ /Applications/Microsoft Excel.app/
home folder system /Users/username/ /Users/username/Library/Containers/com.microsoft.Excel/Data/
home folder local /Users/username/ /Users/username/Library/Containers/com.microsoft.Excel/Data/
home folder network /Users/username/ /Users/username/Library/Containers/com.microsoft.Excel/Data/
home folder user /Users/username/ /Users/username/Library/Containers/com.microsoft.Excel/Data/
home folder /Users/username/ /Users/username/Library/Containers/com.microsoft.Excel/Data/
internet plugins local /Library/Internet Plug-Ins/ /Library/Internet Plug-Ins/
internet plugins user /Users/username/Library/Internet Plug-Ins/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Internet Plug-Ins/
keychain folder system /System/Library/Keychains/ /System/Library/Keychains/
keychain folder local /Library/Keychains/ /Library/Keychains/
keychain folder user /Users/username/Library/Keychains/ /Users/username/Library/Keychains/
keychain folder /Users/username/Library/Keychains/ /Users/username/Library/Keychains/
library folder system /System/Library/ /System/Library/
library folder local /Library/ /Library/
library folder user /Users/username/Library/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/
library folder /Library/ /Library/
modem scripts system /System/Library/Modem Scripts/ /System/Library/Modem Scripts/
modem scripts local /Library/Modem Scripts/ /Library/Modem Scripts/
modem scripts user /Users/username/Library/Modem Scripts/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Modem Scripts/
modem scripts /System/Library/Modem Scripts/ /System/Library/Modem Scripts/
movies folder user /Users/username/Movies/ /Users/username/Movies/
movies folder /Users/username/Movies/ /Users/username/Movies/
music folder user /Users/username/Music/ /Users/username/Music/
music folder /Users/username/Music/ /Users/username/Music/
pictures folder user /Users/username/Pictures/ /Users/username/Pictures/
pictures folder /Users/username/Pictures/ /Users/username/Pictures/
preferences system /System/Library/Preferences/ /System/Library/Preferences/
preferences local /Library/Preferences/ /Library/Preferences/
preferences user /Users/username/Library/Preferences/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Preferences/
preferences /Users/username/Library/Preferences/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Preferences/
printer descriptions local /Library/Printers/PPDs/ /Library/Printers/PPDs/
printer descriptions user /Users/username/Library/Printers/PPDs/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Printers/PPDs/
public folder user /Users/username/Public/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Public/
public folder /Users/username/Public/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Public/
scripting additions system /System/Library/ScriptingAdditions/ /System/Library/ScriptingAdditions/
scripting additions local /Library/ScriptingAdditions/ /Library/ScriptingAdditions/
scripting additions user /Users/username/Library/ScriptingAdditions/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/ScriptingAdditions/
scripting additions /System/Library/ScriptingAdditions/ /System/Library/ScriptingAdditions/
scripts folder local /Library/Scripts/ /Library/Scripts/
scripts folder user /Users/username/Library/Scripts/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Scripts/
scripts folder /Users/username/Library/Scripts/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Scripts/
services folder system /System/Library/Services/ /System/Library/Services/
services folder user /Users/username/Library/Services/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Services/
services folder /Users/username/Library/Services/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Services/
shared documents system /Users/Shared/ /Users/Shared/
shared documents local /Users/Shared/ /Users/Shared/
shared documents network /Users/Shared/ /Users/Shared/
shared documents user /Users/Shared/ /Users/Shared/
shared documents /Users/Shared/ /Users/Shared/
shared libraries user /Users/username/Library/CFMSupport/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/CFMSupport/
sites folder user /Users/username/Sites/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Sites/
sites folder /Users/username/Sites/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Sites/
startup disk system / /
startup disk local / /
startup disk network / /
startup disk user / /
startup disk Classic / /
startup disk / /
startup items system /System/Library/StartupItems/ /System/Library/StartupItems/
startup items local /Library/StartupItems/ /Library/StartupItems/
startup items user /Users/username/Library/StartupItems/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/StartupItems/
startup items /Library/StartupItems/ /Library/StartupItems/
system folder system /System/ /System/
system folder local /System/ /System/
system folder network /System/ /System/
system folder user /System/ /System/
system folder /System/ /System/
system preferences system /System/Library/PreferencePanes/ /System/Library/PreferencePanes/
system preferences local /Library/PreferencePanes/ /Library/PreferencePanes/
system preferences user /Users/username/Library/PreferencePanes/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/PreferencePanes/
system preferences /System/Library/PreferencePanes/ /System/Library/PreferencePanes/
temporary items system /private/var/folders/n1/q8lw4x3s5lv162p52rrrvzj80000gn/T/com.microsoft.Excel/TemporaryItems/ /private/var/folders/n1/q8lw4x3s5lv162p52rrrvzj80000gn/T/com.microsoft.Excel/TemporaryItems/
temporary items local /private/var/folders/n1/q8lw4x3s5lv162p52rrrvzj80000gn/T/com.microsoft.Excel/TemporaryItems/ /private/var/folders/n1/q8lw4x3s5lv162p52rrrvzj80000gn/T/com.microsoft.Excel/TemporaryItems/
temporary items user /private/var/folders/n1/q8lw4x3s5lv162p52rrrvzj80000gn/T/com.microsoft.Excel/TemporaryItems/ /private/var/folders/n1/q8lw4x3s5lv162p52rrrvzj80000gn/T/com.microsoft.Excel/TemporaryItems/
temporary items /private/var/folders/n1/q8lw4x3s5lv162p52rrrvzj80000gn/T/com.microsoft.Excel/TemporaryItems/ /private/var/folders/n1/q8lw4x3s5lv162p52rrrvzj80000gn/T/com.microsoft.Excel/TemporaryItems/
trash user /Users/username/.Trash/ /Users/username/.Trash/
trash /Users/username/.Trash/ /Users/username/.Trash/
users folder system /Users/ /Users/
users folder local /Users/ /Users/
users folder network /Users/ /Users/
users folder user /Users/ /Users/
users folder /Users/ /Users/
utilities folder system /Applications/Utilities/ /Applications/Utilities/
utilities folder local /Applications/Utilities/ /Applications/Utilities/
utilities folder user /Users/username/Applications/Utilities/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Applications/Utilities/
utilities folder /Applications/Utilities/ /Applications/Utilities/
workflows folder user /Users/username/Library/Workflows/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Workflows/
workflows folder /Users/username/Library/Workflows/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Workflows/
printmonitor user /Users/username/Library/Printers/PrintMonitor Documents/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Printers/PrintMonitor Documents/
speakable items user /Users/username/Library/Speech/Speakable Items/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Speech/Speakable Items/
stationery user /Users/username/Library/Stationery/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Stationery/
voices system /System/Library/Speech/Voices/ /System/Library/Speech/Voices/
voices user /Users/username/Library/Speech/Voices/ /Users/username/Library/Containers/com.microsoft.Excel/Data/Library/Speech/Voices/
voices /System/Library/Speech/Voices/ /System/Library/Speech/Voices/

The following errors were raised:

Special Folder Constant Domain Error Description
application support system Special folder 'application support' is not available in the 'system' domain.
application support network Special folder 'application support' is not available in the 'network' domain.
application support Classic Special folder 'application support' is not available in the 'Classic' domain.
applications folder network Special folder 'applications folder' is not available in the 'network' domain.
applications folder Classic Special folder 'applications folder' is not available in the 'Classic' domain.
desktop system Special folder 'desktop' is not available in the 'system' domain.
desktop local Special folder 'desktop' is not available in the 'local' domain.
desktop network Special folder 'desktop' is not available in the 'network' domain.
desktop Classic Special folder 'desktop' is not available in the 'Classic' domain.
desktop pictures folder local Special folder 'desktop pictures folder' is not available in the 'local' domain.
desktop pictures folder network Special folder 'desktop pictures folder' is not available in the 'network' domain.
desktop pictures folder Classic Special folder 'desktop pictures folder' is not available in the 'Classic' domain.
desktop pictures folder Special folder 'desktop pictures folder' is not available
documents folder system Special folder 'documents folder' is not available in the 'system' domain.
documents folder local Special folder 'documents folder' is not available in the 'local' domain.
documents folder network Special folder 'documents folder' is not available in the 'network' domain.
documents folder Classic Special folder 'documents folder' is not available in the 'Classic' domain.
downloads folder system Special folder 'downloads folder' is not available in the 'system' domain.
downloads folder local Special folder 'downloads folder' is not available in the 'local' domain.
downloads folder network Special folder 'downloads folder' is not available in the 'network' domain.
downloads folder Classic Special folder 'downloads folder' is not available in the 'Classic' domain.
favorites folder system Special folder 'favorites folder' is not available in the 'system' domain.
favorites folder local Special folder 'favorites folder' is not available in the 'local' domain.
favorites folder network Special folder 'favorites folder' is not available in the 'network' domain.
favorites folder Classic Special folder 'favorites folder' is not available in the 'Classic' domain.
Folder Action scripts system Special folder 'Folder Action scripts' is not available in the 'system' domain.
Folder Action scripts network Special folder 'Folder Action scripts' is not available in the 'network' domain.
Folder Action scripts Classic Special folder 'Folder Action scripts' is not available in the 'Classic' domain.
fonts system Special folder 'fonts' is not available in the 'system' domain.
fonts local Special folder 'fonts' is not available in the 'local' domain.
fonts network Special folder 'fonts' is not available in the 'network' domain.
fonts user Special folder 'fonts' is not available in the 'user' domain.
fonts Classic Special folder 'fonts' is not available in the 'Classic' domain.
fonts Special folder 'fonts' is not available
help system Special folder 'help' is not available in the 'system' domain.
help local Special folder 'help' is not available in the 'local' domain.
help network Special folder 'help' is not available in the 'network' domain.
help user Special folder 'help' is not available in the 'user' domain.
help Classic Special folder 'help' is not available in the 'Classic' domain.
home folder Classic Special folder 'home folder' is not available in the 'Classic' domain.
internet plugins system Special folder 'internet plugins' is not available in the 'system' domain.
internet plugins network Special folder 'internet plugins' is not available in the 'network' domain.
internet plugins Classic Special folder 'internet plugins' is not available in the 'Classic' domain.
internet plugins Special folder 'internet plugins' is not available
keychain folder network Special folder 'keychain folder' is not available in the 'network' domain.
keychain folder Classic Special folder 'keychain folder' is not available in the 'Classic' domain.
library folder network Special folder 'library folder' is not available in the 'network' domain.
library folder Classic Special folder 'library folder' is not available in the 'Classic' domain.
modem scripts network Special folder 'modem scripts' is not available in the 'network' domain.
modem scripts Classic Special folder 'modem scripts' is not available in the 'Classic' domain.
movies folder system Special folder 'movies folder' is not available in the 'system' domain.
movies folder local Special folder 'movies folder' is not available in the 'local' domain.
movies folder network Special folder 'movies folder' is not available in the 'network' domain.
movies folder Classic Special folder 'movies folder' is not available in the 'Classic' domain.
music folder system Special folder 'music folder' is not available in the 'system' domain.
music folder local Special folder 'music folder' is not available in the 'local' domain.
music folder network Special folder 'music folder' is not available in the 'network' domain.
music folder Classic Special folder 'music folder' is not available in the 'Classic' domain.
pictures folder system Special folder 'pictures folder' is not available in the 'system' domain.
pictures folder local Special folder 'pictures folder' is not available in the 'local' domain.
pictures folder network Special folder 'pictures folder' is not available in the 'network' domain.
pictures folder Classic Special folder 'pictures folder' is not available in the 'Classic' domain.
preferences network Special folder 'preferences' is not available in the 'network' domain.
preferences Classic Special folder 'preferences' is not available in the 'Classic' domain.
printer descriptions system Special folder 'printer descriptions' is not available in the 'system' domain.
printer descriptions network Special folder 'printer descriptions' is not available in the 'network' domain.
printer descriptions Classic Special folder 'printer descriptions' is not available in the 'Classic' domain.
printer descriptions Special folder 'printer descriptions' is not available
public folder system Special folder 'public folder' is not available in the 'system' domain.
public folder local Special folder 'public folder' is not available in the 'local' domain.
public folder network Special folder 'public folder' is not available in the 'network' domain.
public folder Classic Special folder 'public folder' is not available in the 'Classic' domain.
scripting additions network Special folder 'scripting additions' is not available in the 'network' domain.
scripting additions Classic Special folder 'scripting additions' is not available in the 'Classic' domain.
scripts folder system Special folder 'scripts folder' is not available in the 'system' domain.
scripts folder network Special folder 'scripts folder' is not available in the 'network' domain.
scripts folder Classic Special folder 'scripts folder' is not available in the 'Classic' domain.
services folder local Special folder 'services folder' is not available in the 'local' domain.
services folder network Special folder 'services folder' is not available in the 'network' domain.
services folder Classic Special folder 'services folder' is not available in the 'Classic' domain.
shared documents Classic Special folder 'shared documents' is not available in the 'Classic' domain.
shared libraries system Special folder 'shared libraries' is not available in the 'system' domain.
shared libraries local Special folder 'shared libraries' is not available in the 'local' domain.
shared libraries network Special folder 'shared libraries' is not available in the 'network' domain.
shared libraries Classic Special folder 'shared libraries' is not available in the 'Classic' domain.
shared libraries Special folder 'shared libraries' is not available
sites folder system Special folder 'sites folder' is not available in the 'system' domain.
sites folder local Special folder 'sites folder' is not available in the 'local' domain.
sites folder network Special folder 'sites folder' is not available in the 'network' domain.
sites folder Classic Special folder 'sites folder' is not available in the 'Classic' domain.
startup items network Special folder 'startup items' is not available in the 'network' domain.
startup items Classic Special folder 'startup items' is not available in the 'Classic' domain.
system folder Classic Special folder 'system folder' is not available in the 'Classic' domain.
system preferences network Special folder 'system preferences' is not available in the 'network' domain.
system preferences Classic Special folder 'system preferences' is not available in the 'Classic' domain.
temporary items network Special folder 'temporary items' is not available in the 'network' domain.
temporary items Classic Special folder 'temporary items' is not available in the 'Classic' domain.
trash system Special folder 'trash' is not available in the 'system' domain.
trash local Special folder 'trash' is not available in the 'local' domain.
trash network Special folder 'trash' is not available in the 'network' domain.
trash Classic Special folder 'trash' is not available in the 'Classic' domain.
users folder Classic Special folder 'users folder' is not available in the 'Classic' domain.
utilities folder network Special folder 'utilities folder' is not available in the 'network' domain.
utilities folder Classic Special folder 'utilities folder' is not available in the 'Classic' domain.
workflows folder system Special folder 'workflows folder' is not available in the 'system' domain.
workflows folder local Special folder 'workflows folder' is not available in the 'local' domain.
workflows folder network Special folder 'workflows folder' is not available in the 'network' domain.
workflows folder Classic Special folder 'workflows folder' is not available in the 'Classic' domain.
apple menu system Special folder 'apple menu' is not available in the 'system' domain.
apple menu local Special folder 'apple menu' is not available in the 'local' domain.
apple menu network Special folder 'apple menu' is not available in the 'network' domain.
apple menu user Special folder 'apple menu' is not available in the 'user' domain.
apple menu Classic Special folder 'apple menu' is not available in the 'Classic' domain.
apple menu Special folder 'apple menu' is not available
control panels system Special folder 'control panels' is not available in the 'system' domain.
control panels local Special folder 'control panels' is not available in the 'local' domain.
control panels network Special folder 'control panels' is not available in the 'network' domain.
control panels user Special folder 'control panels' is not available in the 'user' domain.
control panels Classic Special folder 'control panels' is not available in the 'Classic' domain.
control panels Special folder 'control panels' is not available
control strip modules system Special folder 'control strip modules' is not available in the 'system' domain.
control strip modules local Special folder 'control strip modules' is not available in the 'local' domain.
control strip modules network Special folder 'control strip modules' is not available in the 'network' domain.
control strip modules user Special folder 'control strip modules' is not available in the 'user' domain.
control strip modules Classic Special folder 'control strip modules' is not available in the 'Classic' domain.
control strip modules Special folder 'control strip modules' is not available
extensions system Special folder 'extensions' is not available in the 'system' domain.
extensions local Special folder 'extensions' is not available in the 'local' domain.
extensions network Special folder 'extensions' is not available in the 'network' domain.
extensions user Special folder 'extensions' is not available in the 'user' domain.
extensions Classic Special folder 'extensions' is not available in the 'Classic' domain.
extensions Special folder 'extensions' is not available
launcher items folder system Special folder 'launcher items folder' is not available in the 'system' domain.
launcher items folder local Special folder 'launcher items folder' is not available in the 'local' domain.
launcher items folder network Special folder 'launcher items folder' is not available in the 'network' domain.
launcher items folder user Special folder 'launcher items folder' is not available in the 'user' domain.
launcher items folder Classic Special folder 'launcher items folder' is not available in the 'Classic' domain.
launcher items folder Special folder 'launcher items folder' is not available
printer drivers system Special folder 'printer drivers' is not available in the 'system' domain.
printer drivers local Special folder 'printer drivers' is not available in the 'local' domain.
printer drivers network Special folder 'printer drivers' is not available in the 'network' domain.
printer drivers user Special folder 'printer drivers' is not available in the 'user' domain.
printer drivers Classic Special folder 'printer drivers' is not available in the 'Classic' domain.
printer drivers Special folder 'printer drivers' is not available
printmonitor system Special folder 'printmonitor' is not available in the 'system' domain.
printmonitor local Special folder 'printmonitor' is not available in the 'local' domain.
printmonitor network Special folder 'printmonitor' is not available in the 'network' domain.
printmonitor Classic Special folder 'printmonitor' is not available in the 'Classic' domain.
printmonitor Special folder 'printmonitor' is not available
shutdown folder system Special folder 'shutdown folder' is not available in the 'system' domain.
shutdown folder local Special folder 'shutdown folder' is not available in the 'local' domain.
shutdown folder network Special folder 'shutdown folder' is not available in the 'network' domain.
shutdown folder user Special folder 'shutdown folder' is not available in the 'user' domain.
shutdown folder Classic Special folder 'shutdown folder' is not available in the 'Classic' domain.
shutdown folder Special folder 'shutdown folder' is not available
speakable items system Special folder 'speakable items' is not available in the 'system' domain.
speakable items local Special folder 'speakable items' is not available in the 'local' domain.
speakable items network Special folder 'speakable items' is not available in the 'network' domain.
speakable items Classic Special folder 'speakable items' is not available in the 'Classic' domain.
speakable items Special folder 'speakable items' is not available
stationery system Special folder 'stationery' is not available in the 'system' domain.
stationery local Special folder 'stationery' is not available in the 'local' domain.
stationery network Special folder 'stationery' is not available in the 'network' domain.
stationery Classic Special folder 'stationery' is not available in the 'Classic' domain.
stationery Special folder 'stationery' is not available
voices local Special folder 'voices' is not available in the 'local' domain.
voices network Special folder 'voices' is not available in the 'network' domain.
voices Classic Special folder 'voices' is not available in the 'Classic' domain.

The following code can be used to test this on your own Mac

Sub GenerateTableOfMacSpecialFolderNamesAndRespectivePaths()
    Dim allMacSpecialFolderNameKeys As Object
    Set allMacSpecialFolderNameKeys = GetAllMacSpecialFolderNameKeys
    
    Debug.Print PadRight("Mac special path name", 41), "Example Path"
    
    Dim returnedPaths As Collection
    Set returnedPaths = New Collection
    
    Dim raisedErrors As Collection
    Set raisedErrors = New Collection
    
    On Error Resume Next
    Dim vSpecialFolderName As Variant, vDomain As Variant, path As String
    For Each vSpecialFolderName In GetAllMacSpecialFolderNames
        For Each vDomain In GetAllMacDomains
            path = GetSpecialFolderMac(vSpecialFolderName, vDomain)
            If Err.Number = 0 Then
                returnedPaths.Add VBA.Array(vSpecialFolderName, vDomain, _
                    PadRight(path, 100), allMacSpecialFolderNameKeys(vSpecialFolderName))
            Else
                raisedErrors.Add VBA.Array(vSpecialFolderName, vDomain, _
                PadRight(Split(Err.description, vbLf)(0), 100), allMacSpecialFolderNameKeys(vSpecialFolderName))
            End If
            On Error GoTo -1
        Next vDomain
    Next vSpecialFolderName
    
    Debug.Print vbNewLine & "The following paths were returned:"
    Dim v As Variant
    For Each v In returnedPaths
        Debug.Print PadRight(v(0), 25), v(1), v(2), v(3)
    Next v
    
    Debug.Print vbNewLine & "The following errors were raised:"
    For Each v In raisedErrors
        Debug.Print PadRight(v(0), 25), v(1), v(2), v(3)
    Next v
End Sub

Private Function PadRight(ByVal str As String, length As Long, _
                           Optional fillerChar As String = " ") As String
    If length > Len(str) Then
        PadRight = str & String(length - Len(str), fillerChar)
    Else
        PadRight = Left(str, length)
    End If
End Function


Private Function GetAllMacSpecialFolderNames() As Collection
    Set GetAllMacSpecialFolderNames = New Collection
    With GetAllMacSpecialFolderNames
        .Add Key:="SFN_APPLICATION_SUPPORT", Item:="application support"
        .Add Key:="SFN_APPLICATIONS_FOLDER", Item:="applications folder"
        .Add Key:="SFN_DESKTOP", Item:="desktop"
        .Add Key:="SFN_DESKTOP_PICTURES_FOLDER", Item:="desktop pictures folder"
        .Add Key:="SFN_DOCUMENTS_FOLDER", Item:="documents folder"
        .Add Key:="SFN_DOWNLOADS_FOLDER", Item:="downloads folder"
        .Add Key:="SFN_FAVORITES_FOLDER", Item:="favorites folder"
        .Add Key:="SFN_FOLDER_ACTION_SCRIPTS", Item:="Folder Action scripts"
        .Add Key:="SFN_FONTS", Item:="fonts"
        .Add Key:="SFN_HELP", Item:="help"
        .Add Key:="SFN_HOME_FOLDER", Item:="home folder"
        .Add Key:="SFN_INTERNET_PLUGINS", Item:="internet plugins"
        .Add Key:="SFN_KEYCHAIN_FOLDER", Item:="keychain folder"
        .Add Key:="SFN_LIBRARY_FOLDER", Item:="library folder"
        .Add Key:="SFN_MODEM_SCRIPTS", Item:="modem scripts"
        .Add Key:="SFN_MOVIES_FOLDER", Item:="movies folder"
        .Add Key:="SFN_MUSIC_FOLDER", Item:="music folder"
        .Add Key:="SFN_PICTURES_FOLDER", Item:="pictures folder"
        .Add Key:="SFN_PREFERENCES", Item:="preferences"
        .Add Key:="SFN_PRINTER_DESCRIPTIONS", Item:="printer descriptions"
        .Add Key:="SFN_PUBLIC_FOLDER", Item:="public folder"
        .Add Key:="SFN_SCRIPTING_ADDITIONS", Item:="scripting additions"
        .Add Key:="SFN_SCRIPTS_FOLDER", Item:="scripts folder"
        .Add Key:="SFN_SERVICES_FOLDER", Item:="services folder"
        .Add Key:="SFN_SHARED_DOCUMENTS", Item:="shared documents"
        .Add Key:="SFN_SHARED_LIBRARIES", Item:="shared libraries"
        .Add Key:="SFN_SITES_FOLDER", Item:="sites folder"
        .Add Key:="SFN_STARTUP_DISK", Item:="startup disk"
        .Add Key:="SFN_STARTUP_ITEMS", Item:="startup items"
        .Add Key:="SFN_SYSTEM_FOLDER", Item:="system folder"
        .Add Key:="SFN_SYSTEM_PREFERENCES", Item:="system preferences"
        .Add Key:="SFN_TEMPORARY_ITEMS", Item:="temporary items"
        .Add Key:="SFN_TRASH", Item:="trash"
        .Add Key:="SFN_USERS_FOLDER", Item:="users folder"
        .Add Key:="SFN_UTILITIES_FOLDER", Item:="utilities folder"
        .Add Key:="SFN_WORKFLOWS_FOLDER", Item:="workflows folder"
                                                                    
        'Classic domain only:
        .Add Key:="SFN_APPLE_MENU", Item:="apple menu"
        .Add Key:="SFN_CONTROL_PANELS", Item:="control panels"
        .Add Key:="SFN_CONTROL_STRIP_MODULES", Item:="control strip modules"
        .Add Key:="SFN_EXTENSIONS", Item:="extensions"
        .Add Key:="SFN_LAUNCHER_ITEMS_FOLDER", Item:="launcher items folder"
        .Add Key:="SFN_PRINTER_DRIVERS", Item:="printer drivers"
        .Add Key:="SFN_PRINTMONITOR", Item:="printmonitor"
        .Add Key:="SFN_SHUTDOWN_FOLDER", Item:="shutdown folder"
        .Add Key:="SFN_SPEAKABLE_ITEMS", Item:="speakable items"
        .Add Key:="SFN_STATIONERY", Item:="stationery"
        .Add Key:="SFN_VOICES", Item:="voices"
    End With
End Function

Private Function GetAllMacSpecialFolderNameKeys() As Collection
    Set GetAllMacSpecialFolderNameKeys = New Collection
    With GetAllMacSpecialFolderNameKeys
        .Add Item:="SFN_APPLICATION_SUPPORT", Key:="application support"
        .Add Item:="SFN_APPLICATIONS_FOLDER", Key:="applications folder"
        .Add Item:="SFN_DESKTOP", Key:="desktop"
        .Add Item:="SFN_DESKTOP_PICTURES_FOLDER", Key:="desktop pictures folder"
        .Add Item:="SFN_DOCUMENTS_FOLDER", Key:="documents folder"
        .Add Item:="SFN_DOWNLOADS_FOLDER", Key:="downloads folder"
        .Add Item:="SFN_FAVORITES_FOLDER", Key:="favorites folder"
        .Add Item:="SFN_FOLDER_ACTION_SCRIPTS", Key:="Folder Action scripts"
        .Add Item:="SFN_FONTS", Key:="fonts"
        .Add Item:="SFN_HELP", Key:="help"
        .Add Item:="SFN_HOME_FOLDER", Key:="home folder"
        .Add Item:="SFN_INTERNET_PLUGINS", Key:="internet plugins"
        .Add Item:="SFN_KEYCHAIN_FOLDER", Key:="keychain folder"
        .Add Item:="SFN_LIBRARY_FOLDER", Key:="library folder"
        .Add Item:="SFN_MODEM_SCRIPTS", Key:="modem scripts"
        .Add Item:="SFN_MOVIES_FOLDER", Key:="movies folder"
        .Add Item:="SFN_MUSIC_FOLDER", Key:="music folder"
        .Add Item:="SFN_PICTURES_FOLDER", Key:="pictures folder"
        .Add Item:="SFN_PREFERENCES", Key:="preferences"
        .Add Item:="SFN_PRINTER_DESCRIPTIONS", Key:="printer descriptions"
        .Add Item:="SFN_PUBLIC_FOLDER", Key:="public folder"
        .Add Item:="SFN_SCRIPTING_ADDITIONS", Key:="scripting additions"
        .Add Item:="SFN_SCRIPTS_FOLDER", Key:="scripts folder"
        .Add Item:="SFN_SERVICES_FOLDER", Key:="services folder"
        .Add Item:="SFN_SHARED_DOCUMENTS", Key:="shared documents"
        .Add Item:="SFN_SHARED_LIBRARIES", Key:="shared libraries"
        .Add Item:="SFN_SITES_FOLDER", Key:="sites folder"
        .Add Item:="SFN_STARTUP_DISK", Key:="startup disk"
        .Add Item:="SFN_STARTUP_ITEMS", Key:="startup items"
        .Add Item:="SFN_SYSTEM_FOLDER", Key:="system folder"
        .Add Item:="SFN_SYSTEM_PREFERENCES", Key:="system preferences"
        .Add Item:="SFN_TEMPORARY_ITEMS", Key:="temporary items"
        .Add Item:="SFN_TRASH", Key:="trash"
        .Add Item:="SFN_USERS_FOLDER", Key:="users folder"
        .Add Item:="SFN_UTILITIES_FOLDER", Key:="utilities folder"
        .Add Item:="SFN_WORKFLOWS_FOLDER", Key:="workflows folder"
                                                                    
        'Classic domain only:
        .Add Item:="SFN_APPLE_MENU", Key:="apple menu"
        .Add Item:="SFN_CONTROL_PANELS", Key:="control panels"
        .Add Item:="SFN_CONTROL_STRIP_MODULES", Key:="control strip modules"
        .Add Item:="SFN_EXTENSIONS", Key:="extensions"
        .Add Item:="SFN_LAUNCHER_ITEMS_FOLDER", Key:="launcher items folder"
        .Add Item:="SFN_PRINTER_DRIVERS", Key:="printer drivers"
        .Add Item:="SFN_PRINTMONITOR", Key:="printmonitor"
        .Add Item:="SFN_SHUTDOWN_FOLDER", Key:="shutdown folder"
        .Add Item:="SFN_SPEAKABLE_ITEMS", Key:="speakable items"
        .Add Item:="SFN_STATIONERY", Key:="stationery"
        .Add Item:="SFN_VOICES", Key:="voices"
    End With
End Function

Private Function GetAllMacDomains() As Collection
    Set GetAllMacDomains = New Collection
    With GetAllMacDomains
        .Add Key:="DOMAIN_SYSTEM", Item:="system"
        .Add Key:="DOMAIN_LOCAL", Item:="local"
        .Add Key:="DOMAIN_NETWORK", Item:="network"
        .Add Key:="DOMAIN_USER", Item:="user"
        .Add Key:="DOMAIN_CLASSIC", Item:="Classic"
        .Add Key:="Default", Item:=""
    End With
End Function

Private Function GetAllMacDomainKeys() As Collection
    Set GetAllMacDomainKeys = New Collection
    With GetAllMacDomainKeys
        .Add Item:="DOMAIN_SYSTEM", Key:="system"
        .Add Item:="DOMAIN_LOCAL", Key:="local"
        .Add Item:="DOMAIN_NETWORK", Key:="network"
        .Add Item:="DOMAIN_USER", Key:="user"
        .Add Item:="DOMAIN_CLASSIC", Key:="Classic"
        .Add Item:="Default", Key:=""
    End With
End Function

MIT License

Copyright (c) 2023 Guido Witt-Dörring

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment