Outlook) (UserProperty.ValidationFormula 属性

返回或设置一个 字符串 ,指示用户属性的验证公式。 读/写。

语法

expressionValidationFormula

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

备注

保存项目时,Outlook 使用验证公式来验证 Value 属性。

示例

下面的 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" 
 
 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

另请参阅

UserProperty 对象

支持和反馈

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