Outlook) (UserProperty.Formula 属性

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

语法

表达式公式

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

示例

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

Sub TestFormula() 
 
 Dim tki As Outlook.TaskItem 
 
 Dim uprs As Outlook.UserProperties 
 
 Dim upr As Outlook.UserProperty 
 
 
 
 Set tki = Application.CreateItem(olTaskItem) 
 
 tki.Subject = "Work hours - Test Formula" 
 
 ' TotalWork and ActualWork are in units of minutes 
 
 tki.TotalWork = 4 * 60 
 
 tki.ActualWork = 3 * 60 
 
 Set uprs = tki.UserProperties 
 
 Set upr = uprs.Add("Total&ActualWork", olFormula) 
 
 upr.Formula = "[Total Work] + [Actual Work]" 
 
 tki.Save 
 
 tki.Display 
 
 MsgBox "The Work Hours are: " & upr.Value / 60 
 
End Sub

另请参阅

UserProperty 对象

支持和反馈

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