View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Wang Wang is offline
external usenet poster
 
Posts: 10
Default How to get path for "my documents"

That's the point! The German version has "\Eigene Dateien" instead of "\My
Documents".

"NickHK" wrote:

But you have
Environ("USERPROFILE") & "\My Documents"

Not sure if this is valid an non-English systems, although the API will
always work.

NickHK

"Wang" wrote in message
...
I've used this loop to print out all the environment variables and have

not
found entry for "mydocuments". The API is quite unfamiliar to me (I've

never
worked with it). But the mothod Moon told me (see his reply) has solved my
question. API might be a topic for my future study. Thank you for your

reply!
wang

"NickHK" wrote:

You can see all the info available from Environ with something like

this:

Dim i As Long
For i = 1 To 35 'Or some suitable number
Debug.Print Environ(i)
Next

However, do not use the numeric index in production, as there is no
guarentee how each computer is organised.
Use the text instead
Environ("USERPROFILE")

Orherwise there is the API route:
http://www.mvps.org/access/api/api0054.htm

NickHK

"Wang" wrote in message
...
Dear gurus:
With environ() I can find homepath or userprofile, but how can I get

the
path for "my documents"? Thanks in advance!
wang