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

Changing a string

Status
Not open for further replies.

gargs

Technical User
Apr 3, 2001
14
NZ
Hi,

I import a list of usernames from a database into an excel spread sheet. The username looks like this:

smith, mark

I want to write a macro to convert the string into an email address. The format I need is:

mark.smith@blahblah.com

I know how to create the email address but I need to know how to change the username into the correct format.

Thanks in advance.

Grattan
 
Dim lngInstr As long
lngInstr = Instr(1,strname,",")
If lnginstr = 0 then ' no comma
strfirstname = ""
strlastname = strname
else
strlastname = Left$(strname,lngInstr-1)
strfirstName = Mid$(strname,lngInst+1)
End if Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
If it works, give it a star - it's the only "payment" people get for helping here - just click on the "Click Here to mark this as a HELPFUL or EXPERT post"
Geoff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top