NewInspector Event

Microsoft Outlook Visual Basic

NewInspector Event

       

Occurs whenever a new inspector window is opened, either as a result of user action or through program code. This event is not available in VBScript.

Sub object_NewInspector(ByVal Inspector As Inspector)

object   An expression that evaluates to an Inspectors collection object.

Inspector   Required. The inspector that was opened.

Remarks

The event occurs after the new Inspector object is created but before the inspector window appears.

Example

This example displays the Standard and Formatting toolbars of an inspector when it is opened. The sample code must be placed in a class module, and the Initialize_handler routine must be called before the event procedure can be called by Microsoft Outlook.

Dim myOlApp As New Outlook.Application
Public WithEvents myOlInspectors As Outlook.Inspectors

Public Sub Initialize_handler()
    Set myOlInspectors = myOlApp.Inspectors
End Sub

Private Sub myOlInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
    Inspector.CommandBars.Item("Standard").Visible = True
    Inspector.CommandBars.Item("Formatting").Visible = True
End Sub