View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jatman jatman is offline
external usenet poster
 
Posts: 88
Default macro for different users... kind of

i am using the line below along with variations throughout in a macro:

ActiveWorkbook.SaveAs "C:\Users\jat\Desktop\Orders\" & fname & ".xlsx", _

the problem that i have is the macro will save on my desktop because it is
my profile's desktop. if i wanted to put the macro on another user's
profile, i do not want to go changing the macro everytime. can the line be
changed so that it goes to the current user's desktop?

i was thinking something like this:

Function ThisUser()
ThisUser = Environ("UserName")
End Function

and the line would be:
ActiveWorkbook.SaveAs "C:\Users\" & %thisuser% & "\Desktop\Orders\" & fname
& ".xlsx", _

this seems a bit too easy, so i think it's wrong... would it work?

jat