有人知道如何在extbox1的userform下验证excel vba中的电子邮件地址吗?
只得到了模式CCD_ 1,但不太确定如何将其应用到函数中。
到目前为止只有:
If .textbox1.Value = "" Then
MsgBox "Please enter email."
Validation = False
Exit Function
End If
用于验证是否存在空文本框。如果有人有任何解决方案,将不胜感激
Function IsEmail_(sEmail$) As Boolean
Dim arr, iPos As Long, iLen As Long
arr = Split(sEmail$, "@")
If UBound(arr) - LBound(arr) <> 1 Then Exit Function
If Len(arr(0)) < 1 Then Exit Function
iLen = Len(arr(1))
If iLen < 3 Then Exit Function
iPos = InStr(1, arr(1), ".", vbBinaryCompare)
If iPos <= 1 Then Exit Function
If iPos = iLen Then Exit Function
IsEmail_ = True
End Function