Hi Dave,
Here's a sample function. And test routine.
Code:
Function ShortEmail(email As String) As String
Dim LB As Integer, RB As Integer 'LB Left Brace RB Right Brace
LB = InStr(email, "<")
RB = InStr(email, ">")
'Debug.Print "email original: " & email
If RB > 0 And LB > 0 Then
email = Trim(Mid(email, 1, LB - 1))
'Debug.Print "email revised: " & email
End If
ShortEmail = email
End Function
Code:
Sub testshortemail()
Dim mail(2) As String, i As Integer
mail(0) = "dave@home.com <dave@home.com> "
mail(1) = "sombodycalled.bob@gmail.com"
mail(2) = " imaGambler@genie.net <ig@genie.net>"
For i = 0 To 2
Debug.Print ShortEmail(mail(i))
Next i
End Sub
which gives: