Inspector Object

The Inspector object is the window where an Outlook item (such as an individual appointment item, e-mail item, and contact item) is displayed. You can capture the Newlnspector event so that you can take action each time an inspector is opened. For example, the code in Listing 10.10 displays the caption of the Inspector in a message box each time a new Inspector is opened.

Listing 10.10. Displaying the caption of an inspector when the Newlnspector event is raised

Dim WithEvents myInspectors As Outlook.Inspectors

Private Sub ThisApplication_Startup(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Startup myInspectors = Me.Inspectors

End Sub

Private Sub myInspectors_NewInspector(ByVal Inspector As _ Microsoft.Office.Interop.Outlook.Inspector) _ Handles myInspectors.NewInspector

MsgBox(Inspector.Caption)

End Sub

0 0

Post a comment