Código
Option Explicit Private Const CSIDL_SYSTEM As Long = &H25 Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As Long) As Long Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long Private Declare Function PathAddBackslash Lib "shlwapi.dll" Alias "PathAddBackslashA" (ByVal pszPath As String) As Long Private Function GetSpecialfolder(ByVal CSIDL As Long) As String Dim sPath As String * 260 If SHGetSpecialFolderLocation(0, CSIDL, CSIDL) = 0 Then If Not SHGetPathFromIDList(CSIDL, sPath) = 0 Then Call PathAddBackslash(sPath) GetSpecialfolder = Left$(sPath, lstrlen(sPath)) End If End If End Function Private Sub Form_Load() Debug.Print GetSpecialfolder(CSIDL_SYSTEM) End Sub