Outlook) (UserProperty.ValidationText 属性

返回或设置指定的用户属性的验证文本的 字符串 。 读/写。

语法

表达式ValidationText

表达 一个代表 UserProperty 对象的变量。

备注

验证文本是 Value 不符合 ValidationFormula 中指定的条件时用户收到的错误消息。

示例

下面的 Visual Basic for Applications (VBA) 示例演示如何使用 有效性ValidationFormula 属性。

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

另请参阅

UserProperty 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。