Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My Documents Location 2

Status
Not open for further replies.

lameid

Programmer
Jan 31, 2001
4,212
US
I have the issue of being able to manage monthly update files in an environment that I expect to change. The reasonable solution seemed to be to determinte the My Documents folder and work from there. After poking around google I found vbscript and converted it. Enjoy.

Code:
Function MyDocumentsFolder() As String
    'Returns the My Documents folder path (or at least in terms of environment variables
    Dim WshShell As Object
    Dim objEnv As Object
    Set WshShell = CreateObject("WScript.Shell")
    Set objEnv = WshShell.Environment("User")
    MyDocumentsFolder = WshShell.RegRead _ 
     ("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal")
    Set objEnv = Nothing
    Set WshShell = Nothing
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top