Reference User Profile

G

Guest

I'm trying to reference the current Window's user's desktop with some code; I
am using the following:

C:\Documents and Settings\%userprofile%\Desktop

When I run the code I get a "Path not Found" message. Just to test, I took
out "%userprofile%" and inserted the actual user name and the code ran fine,
so I'm almost positive that that's the problem. Is that not the correct way
to reference the current user's profle? Any help would be appreciated.
 
D

Douglas J. Steele

strFolder = "C:\Documents and Settings\" & Environ("userprofile") &
"\Desktop"

Having said that, are you SURE that's what you want? On my machine,
userprofile includes C:\Documents and Settings (plus there's always a chance
someone may have his/her profile in a different location). For a far more
reliable approach, see http://www.mvps.org/access/api/api0054.htm at "The
Access Web"
 
G

Guest

Thanks, Doug. You're probably right about user profile locations, so I'll
make use of that article. Thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top