Function GetEmail(txt As String) As String
Dim matches As Object
With CreateObject("VBScript.RegExp")
.Pattern = "\b[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b"
.Global = True
Set matches = .Execute(txt)
GetEmail = ""
If matches.Count Then GetEmail = matches(0)
End With
=GetEmail(A1)
Public Function getEmail(note As String) As String
Dim x As Variant
Dim i As Integer
x = Split(note, " ")
For i = 0 To UBound(x)
If x(i) Like "*@*.*" Then
getEmail = x(i)
Exit Function
End If
Next i
End Function
This post is almost 15 years old and Fairwinds has not been on this site in over a year!I have a question for fairwinds