'Paste this code in a module Const MAX_PATH = 260 Private Type SHITEMID cb As Long abID As Byte End Type Private Type ITEMIDLIST mkid As SHITEMID End Type Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hWnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long Private Function GetSpecialfolder(CSIDL As Long) As String Dim r As Long Dim IDL As ITEMIDLIST 'Get the special folder r = SHGetSpecialFolderLocation(100, CSIDL, IDL) If r = NOERROR Then 'Create a buffer Path$ = Space$(512) 'Get the path from the IDList r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$) 'Remove the unnecessary chr$(0)'s GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1) Exit Function End If GetSpecialfolder = "" End Function 'Acceptable inputs for CSIDL parameter of GetSpecialfolder function 0 = C:\Documents and Settings\Mojtaba\Desktop 2 = C:\Documents and Settings\Mojtaba\Start Menu\Programs 5 = C:\Documents and Settings\Mojtaba\My Documents 6 = C:\Documents and Settings\Mojtaba\Favorites 7 = C:\Documents and Settings\Mojtaba\Start Menu\Programs\Startup 8 = C:\Documents and Settings\Mojtaba\Recent 9 = C:\Documents and Settings\Mojtaba\SendTo 11 = C:\Documents and Settings\Mojtaba\Start Menu 13 = C:\Documents and Settings\Mojtaba\My Documents\My Music 14 = C:\Documents and Settings\Mojtaba\My Documents\My Videos 19 = C:\Documents and Settings\Mojtaba\NetHood 20 = C:\WINDOWS\Fonts 21 = C:\Documents and Settings\Mojtaba\Templates 22 = C:\Documents and Settings\All Users\Start Menu 23 = C:\Documents and Settings\All Users\Start Menu\Programs 24 = C:\Documents and Settings\All Users\Start Menu\Programs\Startup 25 = C:\Documents and Settings\All Users\Desktop 26 = C:\Documents and Settings\Mojtaba\Application Data 27 = C:\Documents and Settings\Mojtaba\PrintHood 28 = C:\Documents and Settings\Mojtaba\Local Settings\Application Data 31 = C:\Documents and Settings\All Users\Favorites 32 = C:\Documents and Settings\Mojtaba\Local Settings\Temporary Internet Files 33 = C:\Documents and Settings\Mojtaba\Cookies 34 = C:\Documents and Settings\Mojtaba\Local Settings\History 35 = C:\Documents and Settings\All Users\Application Data 36 = C:\WINDOWS 37 = C:\WINDOWS\system32 38 = C:\Program Files 39 = C:\Documents and Settings\Mojtaba\My Documents\My Pictures 40 = C:\Documents and Settings\Mojtaba 43 = C:\Program Files\Common Files 45 = C:\Documents and Settings\All Users\Templates 46 = C:\Documents and Settings\All Users\Documents 47 = C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools 48 = C:\Documents and Settings\Mojtaba\Start Menu\Programs\Administrative Tools 53 = C:\Documents and Settings\All Users\Documents\My Music 54 = C:\Documents and Settings\All Users\Documents\My Pictures 55 = C:\Documents and Settings\All Users\Documents\My Videos 56 = C:\WINDOWS\Resources