arnelgp
..forever waiting... waiting for jellybean!
- Local time
- Tomorrow, 04:24
- Joined
- May 7, 2009
- Messages
- 20,321
Code:
Public Function SpecialFolderPath(strFolder As String) As String
' Find out the path to the passed special folder. User on of the following arguments:
' Options For specical folders
' AllUsersDesktop
' AllUsersStartMenu
' AllUsersPrograms
' AllUsersStartup
' Desktop
' Favorites
' Fonts
' MyDocuments
' NetHood
' PrintHood
' Programs
' Recent
' SendTo
' StartMenu
' Startup
' Templates
On Error GoTo ErrorHandler
'Create a Windows Script Host Object
Dim objWSHShell As Object
Set objWSHShell = CreateObject("WScript.Shell")
'Retrieve path
SpecialFolderPath = objWSHShell.SpecialFolders(strFolder & "")
CleanUp:
' Clean up
Set objWSHShell = Nothing
Exit Function
'**************************************
'* Error Handler
'**************************************
ErrorHandler:
MsgBox "Error finding " & strFolder, vbCritical + vbOKOnly, "Error"
Resume CleanUp
End Function