Citar
Private Function comprobar_mail(email As String) As Boolean
Dim ilen, i, pos1, pos2 As Integer
Dim caracter, signo, ter
email = fix_correo(email)
ilen = Len(email)
pos1 = 0
pos2 = 0
comprobar_mail = False
If email = vbNullString Then
Exit Function
End If
For i = 1 To ilen
caracter = Mid(email, i, 1)
If caracter = "@" Then
pos1 = i
End If
If caracter = "." Then
pos2 = i
End If
If caracter = "=" Then
Exit Function
End If
If caracter = "&" Then
Exit Function
End If
If caracter = "$" Then
Exit Function
End If
If caracter = Chr(13) Then
Exit Function
End If
If pos1 > pos2 And pos2 > 0 Then
Exit Function
End If
If i = (ilen - 1) And pos1 = 0 Then
Exit Function
End If
If i = (ilen - 1) And pos2 = 0 Then
Exit Function
End If
If i = ilen And pos1 > 0 And pos2 > 0 Then
comprobar_mail = True
End If
Next i
End Function
en el progrma habria un command button y un cuadro de texto solamente.Dim ilen, i, pos1, pos2 As Integer
Dim caracter, signo, ter
email = fix_correo(email)
ilen = Len(email)
pos1 = 0
pos2 = 0
comprobar_mail = False
If email = vbNullString Then
Exit Function
End If
For i = 1 To ilen
caracter = Mid(email, i, 1)
If caracter = "@" Then
pos1 = i
End If
If caracter = "." Then
pos2 = i
End If
If caracter = "=" Then
Exit Function
End If
If caracter = "&" Then
Exit Function
End If
If caracter = "$" Then
Exit Function
End If
If caracter = Chr(13) Then
Exit Function
End If
If pos1 > pos2 And pos2 > 0 Then
Exit Function
End If
If i = (ilen - 1) And pos1 = 0 Then
Exit Function
End If
If i = (ilen - 1) And pos2 = 0 Then
Exit Function
End If
If i = ilen And pos1 > 0 And pos2 > 0 Then
comprobar_mail = True
End If
Next i
End Function