ganeshvenkatram84
New Member
- Joined
- Jun 9, 2011
- Messages
- 4
Hi All,
I have used the below code for email validation
Private Sub TxtEmail1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With CreateObject("vbscript.regexp")
.Pattern = "^[\w-\.]+@([\w-]+\.)+[A-Za-z]{2,3}$"
If .test(TxtEmail1.Value) Then
MsgBox "OK"
Else
MsgBox "No good"
Cancel = True
End If
End With
End Sub
The code works fine. But in some cases its not working
Example :<TABLE style="WIDTH: 188pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=250 border=0 x:str><COLGROUP><COL style="WIDTH: 188pt; mso-width-source: userset; mso-width-alt: 9142" width=250><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD class=xl25 style="BORDER-RIGHT: #e0dfe3; BORDER-TOP: #e0dfe3; BORDER-LEFT: #e0dfe3; WIDTH: 188pt; BORDER-BOTTOM: #e0dfe3; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" width=250 height=17 x:str="'amrit.boricha@gmail.com.com">amrit.boricha@gmail.com.com</TD></TR></TBODY></TABLE>
Please Assist ASAP
I have used the below code for email validation
Private Sub TxtEmail1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With CreateObject("vbscript.regexp")
.Pattern = "^[\w-\.]+@([\w-]+\.)+[A-Za-z]{2,3}$"
If .test(TxtEmail1.Value) Then
MsgBox "OK"
Else
MsgBox "No good"
Cancel = True
End If
End With
End Sub
The code works fine. But in some cases its not working
Example :<TABLE style="WIDTH: 188pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=250 border=0 x:str><COLGROUP><COL style="WIDTH: 188pt; mso-width-source: userset; mso-width-alt: 9142" width=250><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD class=xl25 style="BORDER-RIGHT: #e0dfe3; BORDER-TOP: #e0dfe3; BORDER-LEFT: #e0dfe3; WIDTH: 188pt; BORDER-BOTTOM: #e0dfe3; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" width=250 height=17 x:str="'amrit.boricha@gmail.com.com">amrit.boricha@gmail.com.com</TD></TR></TBODY></TABLE>
Please Assist ASAP