Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get path for "my documents"
Dear gurus:
With environ() I can find homepath or userprofile, but how can I get the path for "my documents"? Thanks in advance! wang |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get path for "my documents"
"Wang" schreef in bericht ... Dear gurus: With environ() I can find homepath or userprofile, but how can I get the path for "my documents"? Thanks in advance! wang It seems the good old Windows Script Host offers help: Dim wsh Set wsh = CreateObject("WScript.Shell") MsgBox wsh.SpecialFolders("MyDocuments") Set wsh = Nothing |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get path for "my documents"
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get path for "my documents"
It works fine. Thank you, Moon!
"moon" wrote: "Wang" schreef in bericht ... Dear gurus: With environ() I can find homepath or userprofile, but how can I get the path for "my documents"? Thanks in advance! wang It seems the good old Windows Script Host offers help: Dim wsh Set wsh = CreateObject("WScript.Shell") MsgBox wsh.SpecialFolders("MyDocuments") Set wsh = Nothing |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get path for "my documents"
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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get path for "my documents"
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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get path for "my documents"
Use the API route in the link then, with
Public Const CSIDL_PERSONAL = &H5 NickHK "Wang" ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete emty file names from "recent documents" Excel | Excel Discussion (Misc queries) | |||
How to show "DRAFT" on print versions of test documents. | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
How do I move a document from "recent items" to "documents" | New Users to Excel | |||
Problems updating shared documents which used "Lookup" function | Excel Discussion (Misc queries) |