UserProperty.ValidationText Property (Outlook)
Published: July 16, 2012
Returns or sets a String specifying the validation text for the specified user property. Read/write.
The following Visual Basic for Applications (VBA) example demonstrates the use of ValidationText and ValidationFormula properties.
Sub TestValidation() Dim tki As Outlook.TaskItem Dim uprs As Outlook.UserProperties Dim upr As Outlook.UserProperty Set tki = Application.CreateItem(olTaskItem) tki.Subject = "Work hours" ' TotalWork is stored in units of minutes tki.TotalWork = 3000 Set uprs = tki.UserProperties Set upr = uprs.Add("TotalWork", olFormula) upr.Formula = "[Total Work]" upr.ValidationFormula = ">= 2400" upr.ValidationText = """The Work Hours (TotalWork) should be equal or greater than 5 days """ tki.Save tki.Display MsgBox "The Work Hours are: " & upr.Value / 60 End Sub