当 Outlook 项目的自定义属性更改时发生。属性名传递给过程,以便于用户确定哪个自定义属性被更改。
Sub object_CustomPropertyChange(ByVal Name As String)
object 该对象的值为“应用于”列表中的一个对象。在 VBScript 中,用 Item 代替。
Name 必选。被更改的自定义属性名。
本 VBScript 示例使用 CustomPropertyChange 事件,在某个 Boolean 字段设置为 True 时启用某控件。
本示例在窗体的第二页创建两个自定义字段。第一个字段是名为“RespondBy”的 Boolean 字段,第二个字段名为“DateToRespond”。
Sub Item_CustomPropertyChange(ByVal myPropName)
Select Case myPropName
Case "RespondBy"
Set myPages = Item.GetInspector.ModifiedFormPages
Set myCtrl = myPages("P.2").Controls("DateToRespond")
If Item.UserProperties("RespondBy").Value Then
myCtrl.Enabled = True
myCtrl.Backcolor = 65535 'Yellow
Else
myCtrl.Enabled = False
myCtrl.Backcolor = 0 'Black
End If
Case Else
End Select
End Sub