Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable for User's My Documents folder? 1

Status
Not open for further replies.

AlexCuse

Programmer
Apr 13, 2006
5,416
US
Hi All,

I have a .pdf report printing from Access to 'My Documents'. I then move this .pdf using code to an archived folder on a network drive. I need to change my filecopy command so that the source is as follows:

"c:\documents and settings\" USER "\My Documents\"

where USER = user currently running the process. Any advice on how I could accomplish this would be greatly appreciated. Thanks a lot,

Alex

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
You may try this:
"c:\documents and settings\" & Environ("USERNAME") & "\My Documents\"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
AlexCuse,
Or [tt]VBA.Environ$("USERPROFILE")[/tt] which returns [tt]c:\documents and settings\User Name[/tt] on a standard computer.

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
That looks like the ticket. Thanks PH, as always!

It's a magical time of year in Philadelphia. Eagles training camp marks the end of another brutal season of complaining about the Phillies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top