Email address verification

  • Thread starter jackrosiemaisie
  • Start date
J

jackrosiemaisie

Does anyone know of an Excel add-in that I could buy/have? Specificall
a routine that would verify that an email address has an @ sign an
ends with a valid domain suffix e.g. .com or .org.uk. Plus, doesn'
contain illegal characters e.g space or comma or forward slash.

I would very much appreciate anyones help.

Thanks in anticipation.

Peter Watkinso
 
F

Frank Kabel

Hi
one way: Enter the following code in one of your workbook
modules

Public Function MailaddressOK(Adresse As String) As Boolean
Dim oVScriptRegEx As Object
Set oVScriptRegEx = CreateObject("VBScript.RegExp")
With oVScriptRegEx
.Pattern = "^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)
*\.\w+$"
MailaddressOK = .test(Adresse)
End With
End Function

you may have to register the VBSCRIPT object first in the
VBE to use
regular expressions.

in your worksheet you can now enter the formula
=MailaddressOK(A1)
to check A1 for a valid email
 
Top