Share via


UserProperty.ValidationText Property

Outlook Developer Reference

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

Syntax

expression.ValidationText

expression   A variable that represents a UserProperty object.

Example

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

Visual Basic for Applications
  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

Remarks

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

See Also