Email verification

PHOTO EMBED

Tue Oct 04 2022 16:24:20 GMT+0000 (Coordinated Universal Time)

Saved by @paulbarry

Option Explicit

Const MODULE_NAME As String = "modMail"

'' Validate email address
Public Function ValidateEmailAddress(ByVal strEmailAddress As String) As Boolean
    On Error GoTo Catch
    
    Dim objRegExp As New RegExp
    Dim blnIsValidEmail As Boolean
    
    objRegExp.IgnoreCase = True
    objRegExp.Global = True
    objRegExp.Pattern = "^([a-zA-Z0-9_\-\.]+)@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"
    
    blnIsValidEmail = objRegExp.Test(strEmailAddress)
    ValidateEmailAddress = blnIsValidEmail
      
    Exit Function
    
Catch:
    ValidateEmailAddress = False
    MsgBox "Module: " & MODULE_NAME & " - ValidateEmailAddress function" & vbCrLf & vbCrLf _
		& "Error#:  " & Err.Number & vbCrLf & vbCrLf & Err.Description
content_copyCOPY

http://www.geeksengine.com/article/validate-email-vba.html