Les Isaacs
Registered User.
- Local time
- Today, 00:35
- Joined
- May 6, 2008
- Messages
- 186
Hello All
I have a module in an accdb that creates a complex excel file, and as part of this a lot of validation rules are applied to certain columns, e.g.
I now need to add a validation rule to check for a valid email address, but I'm not sure what to put on the .Add type line. I think the only restriction on the rule will be that the data must contain a '@', and possibly also a 'dot' (unless anyone knows of any tighter restriction for email addresses), but how do I represent this with .Add type, Operator and Formula1?
Hope someone can help.
Many thanks
Les
I have a module in an accdb that creates a complex excel file, and as part of this a lot of validation rules are applied to certain columns, e.g.
Code:
'Stop if Joining NHSP is invalid date
2010 With objSheet.range("W" & lngRowCount + 1).Validation
2020 .Add type:=xlValidateDate, AlertStyle:=xlValidAlertStop, Operator:=xlGreater, Formula1:="1/1/1997"
2030 .IgnoreBlank = True
2040 .InputTitle = ""
2050 .ErrorTitle = "Invalid Date"
2060 .InputMessage = ""
2070 .ErrorMessage = "Please enter a valid date, in the format dd/mm/yy, after 01/01/97"
2080 End With
Hope someone can help.
Many thanks
Les