OptionsPagesAdd Event

Microsoft Outlook Visual Basic

OptionsPagesAdd Event

       

Occurs whenever the Options dialog box (available through the Tools menu) or a folder Properties dialog box is opened. This event is not available in VBScript.

Sub object_OptionsPagesAdd(ByVal Pages As PropertyPages, ByVal Folder As MAPIFolder)

object   An expression that evaluates to an Application or a NameSpace object.

Pages   Required. The collection of property pages that have been added to the dialog box. This collection includes only custom property pages. It does not include standard Microsoft Outlook property pages.

Folder   This argument is only used with the MAPIFolder object. Required. The MAPIFolder object for which the Properties dialog box is being opened.

Remarks

Your program handles this event to add a custom property page. If object is an Application object, the property page will be added to the Options dialog box. If object is a NameSpace object, the property page will be added to Properties dialog box of the specified folder. When the event fires, the PropertyPages collection object identified by Pages contains the property pages that have been added prior to the event handler being called. To add your property page to the collection, use the Add method of the PropertyPages collection before exiting the event handler.

Example

This example adds a new property page to the Microsoft Outlook Options dialog box. The sample code must be placed in a class module of a Common Object Model (COM) add-in.

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