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

Noob variable question with objMail.To 1

Status
Not open for further replies.
Sep 13, 2012
2
GB
Ok

So noob here with vbs, so hang in there :)
Im trying to take a variable (like the logged on user) and put this infront of our domain name to create an email address to populate "objMail.To"

so this part of the codes works, and dispalays the username :

Dim objNetwork
Dim userName
Set objNetwork = CreateObject("WScript.Network")
userName = objNetwork.UserName
WScript.Echo userName


But I bin the last line as i dont need it to be displayed, I want to use this to create an email address now.

so I have my next bit of code working if i put my email address after the "objMail.To" command like this

objMail.To = myname@mydomain.co.uk

I get the email, happy days.

But I want to use the above variable here, so the email is created automatically, and i dont know the syntax to use.
This is what I want, but i dont know how to do it ! :) (username here being the variable from above)

objMail.To = username@mydomain.co.uk

hope this makes sense
 
I'd try this:
objMail.To = username & "@mydomain.co.uk"


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top