ValidationText Property

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

expression**.ValidationText**

*expression    * Required. An expression that returns a UserProperty object.

Example

The following Visual Basic for Applications (VBA) example demonstrates the use of ValidationText and ValidationFormula properties.

Sub TestValidation()
    Dim outApp As New Outlook.Application
    Dim tki As Outlook.TaskItem
    Dim uprs As Outlook.UserProperties
    Dim upr As Outlook.UserProperty
    
    Set tki = outApp.CreateItem(olTaskItem)
    tki.Subject = "Work hours"
    tki.TotalWork = 3000
    Set uprs = tki.UserProperties
    Set upr = uprs.Add("TotalWork", olFormula)
    upr.Formula = "[Total Work]"
    upr.ValidationFormula = ">= 2400"
    upr.ValidationText = """The WorkHours (Total Work) should be equal or greater than 5 days """
    tki.Save
    tki.Display
    
   MsgBox "The Work Hours are: " & upr.Value
End Sub

Applies to | UserProperty Object

See Also | ValidationFormula Property