ok the funtion looks like this
Public Function ValEmail(mail As String) If Left(mail, 1) = "@" Then GoTo NotValide ElseIf Right(mail, 1) = "@" Then GoTo NotValide ElseIf InStr(1, mail, "@") = False Then MsgBox "The @ is Missing!" ElseIf InStr(1, mail, ".") = False Then GoTo NotValide ElseIf Right(mail, 1) = "." Then GoTo NotValide ElseIf Left(mail, 1) = "." Then GoTo NotValide 'Not Valide NotValide: MsgBox "This is Not a Valide Email Address!" End If End Function
first part of the funtion like u see is
If Left(mail, 1) = "@" Then GoTo NotValide
So this part looks for the @ on the first place of the string if the string is in the format @somthing
then its not valide so that the funtion calls the goto funtion and moves to NotValide
Next Part like you see is
ElseIf Right(mail, 1) = "@" Then GoTo NotValideits the same as above but this looks from the right if the first char is a @ its again a Invalide Email and again
we call goto
Next Part is
ElseIf InStr(1, mail, "@") = False Then MsgBox "The @ is Missing!"This is a easy if stament we use the instr funtion to make a bool statment dont know the right word for it
in english hope you know what i mean so if the instr funtion returns false we know that the @ is missing
and this is again not a valide email address and we then call a msgbox to tell that the @ is missing
Next Part is
ElseIf InStr(1, mail, ".") = False Then GoTo NotValideThis is again a bool statment that looks for what the funtion returns if instr funtion returns false
we know that a . is missing so its not a valide email address if instr returns a true the . is present so it
an valide email :D **** im not good at making tutorials anyway lets continue
Next Part is
ElseIf Right(mail, 1) = "." Then GoTo NotValide ElseIf Left(mail, 1) = "." Then GoTo NotValideive combined both statments here this do just like the first and second part in the tutorial it looks if the first from
right or first from left is a . if yes its not a valide email address.
last part is
NotValide: MsgBox "This is Not a Valide Email Address!" End IfThis is the error code in case @ is first symbol from left or right or . is first symbol from left or right
Ok wow i never make a tutorial ok this funtion is just a basic one did it within 10 minutes but thought its
worth to post it Copyright of this Funtion NanoXcore thats me with dren,egzon,elban,limi :D


Sign In
Create Account



Back to top










