当打开“选项”对话框(单击“工具”菜单中的“选项”可弹出此对话框)或文件夹“属性”对话框时发生。该事件在 VBScript 中不可用。
Sub object_OptionsPagesAdd(ByVal Pages As PropertyPages, ByVal Folder As MAPIFolder)
object 该表达式的值为 Application 或 NameSpace 对象。
Pages 必选。已添加到对话框中的属性页集合。该集合仅包含自定义属性页。不包含标准 Microsoft Outlook 属性页。
Folder 该参数仅用于 MAPIFolder 对象。必选。为其打开 Properties 对话框的 MAPIFolder 对象。
程序处理该事件以添加自定义属性页。如果 object 为 Application 对象,那么属性页将添加到“选项”对话框中。如果 object 为 NameSpace 对象,那么属性页将添加到指定文件夹的“属性”对话框中。该事件触发时,由 Pages 确定的 PropertyPages 集合对象将包含调用事件处理器之前添加的属性页。要将属性页添加到集合中,请在退出事件处理器前使用 PropertyPages 集合的 Add 方法。
本示例将新属性页添加到 Microsoft Outlook 的“选项”对话框中。示例代码必须放在 Common Object Model (COM) 加载项的类模块中。
Implements IDTExtensibility2
Private WithEvents OutlApp As Outlook.Application
Private Sub IDTExtensibility2_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
Set OutlApp = Application
End Sub
Private Sub OutlApp_OptionsPagesAdd(ByVal Pages As Outlook.PropertyPages)
Dim myPage As Object
Set myPage = CreateObject("PPE.CustomPage")
Pages.Add myPage
End Sub