Ich möchte in eine TextBox die email eingeben und gleich prüfen ob sie korrekt ist, was muss ich eingeben?
Private Sub TextBox7_Change()
End Sub
wäre schon wenn mir das jemand zeigen könnte.Gruss MaBlu
Private Sub TextBox7_Change()
End Sub
wäre schon wenn mir das jemand zeigen könnte.
Private Sub TextBox7_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not IsValidMailAddress(TextBox7) And TextBox7 <> "" Then
Cancel = True
MsgBox "Mail-Adresse ungültig!", vbExclamation
End If
End Sub
Private Function IsValidMailAddress(ByVal strAddress As String) As Boolean
Dim oRegExp As Object
Set oRegExp = CreateObject("vbscript.regexp")
With oRegExp
.Pattern = "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|" & _
"}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:" & _
"[a-z0-9-]*[a-z0-9])?"
.IgnoreCase = True
IsValidMailAddress = .test(strAddress)
End With
Set oRegExp = Nothing
End Function