![]() |
Location of "My Documents"
I wrote some VBA for a co-worker and everything was pretty simple because I
knew she was using Windows 98 and the location of the My Documents folder could be accessed with "C:\My Documents". But now, I have been asked to make this work for others that may be using Windows 2000 or windows XP. I have realized that the location of the My Documents folder on Windows XP is "C:\Documents and Settings\Ken\My Documents". Now I realize I need to somehow test for or determine the location of the My Documents folder. Can someone please suggest an online article about this or give me some suggestions? Thanks, Ken |
Location of "My Documents"
why don't you use doc and settings\all users\documents? that's a shared
resource for anyone that logs in -- Gary "Ken Loomis" wrote in message ... I wrote some VBA for a co-worker and everything was pretty simple because I knew she was using Windows 98 and the location of the My Documents folder could be accessed with "C:\My Documents". But now, I have been asked to make this work for others that may be using Windows 2000 or windows XP. I have realized that the location of the My Documents folder on Windows XP is "C:\Documents and Settings\Ken\My Documents". Now I realize I need to somehow test for or determine the location of the My Documents folder. Can someone please suggest an online article about this or give me some suggestions? Thanks, Ken |
Location of "My Documents"
Hi Ken:
See: Application.DefaultFilePath --- Regards, Norman "Ken Loomis" wrote in message ... I wrote some VBA for a co-worker and everything was pretty simple because I knew she was using Windows 98 and the location of the My Documents folder could be accessed with "C:\My Documents". But now, I have been asked to make this work for others that may be using Windows 2000 or windows XP. I have realized that the location of the My Documents folder on Windows XP is "C:\Documents and Settings\Ken\My Documents". Now I realize I need to somehow test for or determine the location of the My Documents folder. Can someone please suggest an online article about this or give me some suggestions? Thanks, Ken |
Location of "My Documents"
Hi Ken,
Try this Dim oWSH As Object Const wsh_SPECIAL_FOLDER_MY_DOCS As Long = 16 Set oWSH = CreateObject("WScript.Shell") MsgBox oWSH.SpecialFolders(wsh_SPECIAL_FOLDER_MY_DOCS) -- HTH Bob Phillips "Ken Loomis" wrote in message ... I wrote some VBA for a co-worker and everything was pretty simple because I knew she was using Windows 98 and the location of the My Documents folder could be accessed with "C:\My Documents". But now, I have been asked to make this work for others that may be using Windows 2000 or windows XP. I have realized that the location of the My Documents folder on Windows XP is "C:\Documents and Settings\Ken\My Documents". Now I realize I need to somehow test for or determine the location of the My Documents folder. Can someone please suggest an online article about this or give me some suggestions? Thanks, Ken |
Location of "My Documents"
Ken,
Try the code below. HTH, Bernie MS Excel MVP Sub test() Dim MyFilePath As String MyFilePath = MyPCpath("MyDocuments") MsgBox "The path is " & MyFilePath End Sub Public Function MyPCpath$(Folder) MyPCpath = CreateObject("WScript.Shell").SpecialFolders _ (Folder) & Application.PathSeparator End Function "Ken Loomis" wrote in message ... I wrote some VBA for a co-worker and everything was pretty simple because I knew she was using Windows 98 and the location of the My Documents folder could be accessed with "C:\My Documents". But now, I have been asked to make this work for others that may be using Windows 2000 or windows XP. I have realized that the location of the My Documents folder on Windows XP is "C:\Documents and Settings\Ken\My Documents". Now I realize I need to somehow test for or determine the location of the My Documents folder. Can someone please suggest an online article about this or give me some suggestions? Thanks, Ken |
Location of "My Documents"
Hi Ken
See Randy Birch's http://vbnet.mvps.org/code/browse/csidl.htm on this. It's VB6 code, so the form code needs some rewrite for VBA use. It's a great cross-version library for My Documents, temp folder, application data folder, program files, IE history, Start menu, Desktop, ... HTH. Best wishes Harald "Ken Loomis" skrev i melding ... I wrote some VBA for a co-worker and everything was pretty simple because I knew she was using Windows 98 and the location of the My Documents folder could be accessed with "C:\My Documents". But now, I have been asked to make this work for others that may be using Windows 2000 or windows XP. I have realized that the location of the My Documents folder on Windows XP is "C:\Documents and Settings\Ken\My Documents". Now I realize I need to somehow test for or determine the location of the My Documents folder. Can someone please suggest an online article about this or give me some suggestions? Thanks, Ken |
All times are GMT +1. The time now is 11:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com