OptionsPagesAdd Event

Microsoft Outlook Visual Basic

Occurs whenever the Options dialog box (on the Tools menu) or a folder Properties dialog box is opened. This event is not available in Microsoft Visual Basic Scripting Edition (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 Microsoft Visual Basic/Visual Basic for Applications (VBA) example adds a new property page to the Outlook Options dialog box. The sample code must be placed in a class module of a Component 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)
  Pages.Add "PPE.SimplePage", "Simple Page" 
  'PPE.SimplePage is a ProgID of the registered ActiveX Control - the property page that is to be displayed in the COM add-in
End Sub