Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default 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




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default 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






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default 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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default 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






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
Delete emty file names from "recent documents" Excel Touble in Excel Excel Discussion (Misc queries) 2 March 22nd 10 08:10 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How do I move a document from "recent items" to "documents" John Gerke in Central Oregon New Users to Excel 1 March 2nd 08 08:31 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 02:19 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"