ContactItem 事件 (Outlook)ContactItem.CustomPropertyChange event (Outlook)

当项目(父对象的一个实例)的自定义属性更改时发生。Occurs when a custom property of an item (which is an instance of the parent object) is changed.

语法Syntax

expressionexpression. CustomPropertyChange( _Name_ )

_表达式_一个代表ContactItem对象的变量。expression A variable that represents a ContactItem object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
NameName 必需Required StringString 被更改的自定义属性的名称。The name of the custom property that was changed.

说明Remarks

属性名传递给过程,以便于用户确定哪个自定义属性被更改。The property name is passed to the procedure so that you can determine which custom property changed.

示例Example

此 Microsoft Visual Basic 脚本版本 (VBScript) 示例使用CustomPropertyChange事件在将Boolean字段设置为True时启用控件。This Microsoft Visual Basic Scripting Edition (VBScript) example uses the CustomPropertyChange event to enable a control when a Boolean field is set to True.

此示例中,窗体第二页上创建两个自定义字段。For this example, create two custom fields on the second page of a form. 第一个是布尔值字段, 名为 "RespondBy"。The first, a Boolean field, is named "RespondBy". 第二个字段的名称为"DateToRespond"。The second field is named "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

另请参阅See also

创建 ContactItem 对象ContactItem Object

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.