first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

basIsEmailValid(); This function checks for a valid email address.

Function basIsEmailValid(ByVal EmailAddr As String) As Boolean 'This function checks for a valid email address. Dim lngPosAtSymbol As Long Dim lngPosPeriod As Long Dim lngPosSpace As Long Dim lngLength As Long

basIsEmailValid = False
If VBA.Len(EmailAddr) = 0 Then Exit Function
If VBA.InStr(1, EmailAddr, "@", vbTextCompare) = 0 Then Exit Function

lngPosAtSymbol = GetCharPos(EmailAddr, "@", 1)
lngPosPeriod = GetCharPos(EmailAddr, ".")
lngPosSpace = GetCharPos(EmailAddr, VBA.Space$(1), 1)
lngLength = VBA.Len(EmailAddr)


If (lngPosAtSymbol < 1) _
    Or (lngPosAtSymbol = lngLength) _
    Or (VBA.Mid$(EmailAddr, lngPosAtSymbol + 1, 1) = ".") _
    Or (VBA.Mid$(EmailAddr, lngPosAtSymbol - 1, 1) = ".") _
    Or (lngPosPeriod > lngLength - 2) _
    Or (lngPosSpace > 0) Then
    basIsEmailValid = False
Else
    basIsEmailValid = True
End If

End Function

mod date: 2005-02-04T05:05:23.000Z