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

help with replace function 1

Status
Not open for further replies.

starclassic

Technical User
May 24, 2007
27
US
I have a lot of email address with this format
jane.doe.abcd@companyname.com
wants to write a funtion and results
will be like this --> Jane Doe
Any Idea?
 
Have a look at left, mid, upper and InStr functions. But know that this will probably fail on email addresses not following the format you specify.

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
A starting point:
strEmail = "jane.doe.abcd@companyname.com"
Dim a
a = Split(Left(strEmail, InStr(strEmail, "@") - 1), ".")
strName = StrConv(a(0) & " " & a(1), vbProperCase)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
. . . or perhaps this function:
Code:
[blue]Public Function Leader2(adrEmail As String) As String
   Dim Ary
   
   If adrEmail Like "*.*.*.*" Then
      Ary = Split(adrEmail, ".")
      Leader2 = StrConv(Ary(0) & " " & Ary(1), vbProperCase)
   End If

End Function[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see FAQ219-2884:
 
Thanks a lot, I have created my own function and works quite well, but PHV is more simpler.

Thanks again.
 
AceMan,

In all the years that I've worked with VBA, I never knew I could use a Like statement in a condition like that. Learnt me something new today. Have a star on me.

Thanks!
Larry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top