Frewins
07-20-2003, 07:47 AM
My application uses commondialog.ShowSave with the initial directory set by the statement dlog.InitDir = "C:\Documents and Settings\MYName\My Documents".
I have been unable to code this in a way that allows another user to access ...\SomeOtherName\My Documents.(The application is intended to run under WindowsXP)
It surely must be possible - can somebody help, please?
chadbh74
07-20-2003, 11:54 AM
Did you hardcode that path in? Do you want the program to automaticallly use the current user's "My Documents" directory? If so, perhaps you should try using VB's Environ$ function to retrieve the current value of the HOMEDRIVE and HOMEPATH system variables. These will point to the current user's home directory. This directory will have several standard directories inside that you can specify as necessary.
For example,
\My Documents
\Start Menu
\Desktop
charlie
07-20-2003, 03:04 PM
Well, I haven't got Windows XP, but you can try to do a little Login Form (even without password) where the program gets the name of the user. Then you can set the statement:
dlog.InitDir = "C:\Documents and Settings\" & USERNAME & "\My Documents"
This is only valid if the directory is always the same, I mean, "C:\My documents and settings...."
Sorry if you don't like it.
Frewins
07-21-2003, 08:21 AM
Many thanks, chadbh74 . I struggled a wee bit, but environ is doing the business, and I am now well under way.