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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Environ("username") with email

Status
Not open for further replies.

H1004

MIS
Oct 28, 2003
136
US
I'm using a sendobject macro to automatically send email to the user with the result from Environ("username". In the To section, I wrote Environ("username")&@company.com

But that doesn't work...What am I doing wrong?
thank you
 
is that really what the email addresses are at the company you're sending to?

Environ("Username") will get the Windows NT userID of the person logged on to the machine. So they'll be sending an email to themselves. IF the company is their own, that is.

Is this really your intent?

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Yes, that is my intent for them to email this report to themselves once they are done with the program.
And that's why I want to use Window NT ID with @company.com
Thank you
 
Replace this:
Environ("username")&@company.com
By this:
Environ("username") & "@company.com"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
At my company, environ("Username") is enough. Try this:

start a new email. Put your NT ID in the TO: portion. Click the CHECK NAMES button and see if it translates to your email address for you.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
One thing to note is that I'm setting this up in a macro, and the To field somehow doesn't like just Environ("username")...Is there something else that I need to put in???
I've tried
&Environ("username") And I tried Environ('username')
 
make a new code module and paste this in:

Function GetUserID()
GetUserID = VBA.Environ("Username")
End Function

Then in the macro, instead of Environ("Username"), put GetUserID(). see if that works.

g

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top