Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Finding a user's My Documents path

Ron,
Thanks for pointing out the caveats. I will be sure to use your code below.
Thanks again,
Bob


"Ron de Bruin" wrote:

"My Documents" in Vista, but I could be wrong about that.


Correct

C:\Users\Ron\Documents


The OP can try this
If I rename my folder to "DocumentsFromRon" the code will work for me Harlan to open the folder

Sub GetSpecialFolder()
'Special folders are : AllUsersDesktop, AllUsersStartMenu
'AllUsersPrograms, AllUsersStartup, Desktop, Favorites
'Fonts, MyDocuments, NetHood, PrintHood, Programs, Recent
'SendTo, StartMenu, Startup, Templates

Dim WshShell As Object
Dim SpecialPath As String

Set WshShell = CreateObject("WScript.Shell")
SpecialPath = WshShell.SpecialFolders("MyDocuments")

'Open folder in Explorer
Shell "explorer.exe " & SpecialPath, vbNormalFocus
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Harlan Grove" wrote in message ...
"Gary Keramidas" <GKeramidasATmsn.com wrote...
here' another way
fpath = environ("userprofile") & "\My Documents\"

...

Not guaranteed to work when users change the name of their "My Documents"
folder (which, FWLIW, I've done myself). And I believe it's no longer called
"My Documents" in Vista, but I could be wrong about that.

The only guaranteed correct way to determine a user's "My Documents"
folder's drive/directory path is by going into the Windows Registry, in the

HKCU\Software\Microsoft\Windows\CurrentVersion\Exp lorer\Shell Folders

key, and finding the value of the Personal value-name.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting File name and path in Excel 2007 Documents Christine Excel Discussion (Misc queries) 2 January 16th 08 12:11 AM
User wants to see full path in recent documents Excel 2007 wadeyk Excel Discussion (Misc queries) 4 October 25th 07 11:08 PM
How can I automatically print file path on documents Brenda @ FCA Excel Discussion (Misc queries) 6 May 17th 07 02:55 PM
How to path to user's desktop 1scant[_8_] Excel Programming 2 June 16th 06 03:52 PM
Can't See Path to Recently Used Documents in Excel 2000 Dick in Detroit Excel Discussion (Misc queries) 1 April 13th 05 11:33 PM


All times are GMT +1. The time now is 01:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"