Export (0) Print
Expand All

UserProperty.ValidationText Property (Outlook)

Published: July 16, 2012

Returns or sets a String specifying the validation text for the specified user property. Read/write.

expression .ValidationText

expression A variable that represents a UserProperty object.

The validation text is the error message that a user receives when the Value does not meet the criteria specified in ValidationFormula.

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 """ 
 MsgBox "The Work Hours are: " & upr.Value / 60 
End Sub

Community Additions

© 2014 Microsoft