I am using the below Regular Expression which works fine in case of date validation. But if I select the date from the DatePicket even then it throws alert:Enter valid date. How can I modify the regular expression so as to be compatible with DatePicker.
Set RegularExpressionObject = New RegExp
With RegularExpressionObject
.Pattern = "^(((0?[1-9]|[12]\d|3[01]).-\/.-\/?\d{2}))|((0?[1-9]|[12]\d|30).-\/.-\/?\d{2}))|((0?[1-9]|1\d|2[0-8])[.-\/]0?2.-\/?\d{2}))|(29[.-\/]0?2.-\/?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))$"
.IgnoreCase = True
.Global = True
End With
expressionmatch = RegularExpressionObject.Test(TxtVal)
If expressionmatch Then
Else
msgbox "You must enter a valid Date.",,"Invalidentry"
form1.item(OHldr).focus()
Exit Function
End if