Microsoft Office 2000/Visual Basic Programmer's Guide   

Understanding the Explorer and Inspector Objects

The Explorer object represents what you would recognize as the Outlook user interface. For example, when you open Microsoft Outlook, you are working in the Outlook Explorer object. A window that contains a specific Outlook item, such as a mail message or a contact, is an Outlook Inspector object.

You can open these objects programmatically and display items for the user. You can also use the ActiveExplorer and ActiveInspector methods of the Application object to return a programmatic reference to the Explorer or Inspector object that the user is currently working with.

If you want to use VBA to add, remove, or manipulate command bars in Outlook, you start with a reference to the Explorer or Inspector object that contains the command bar you want to use and then use the object's CommandBars property to return a reference to the object's CommandBars collection. For example, the following code illustrates how to get a reference to the CommandBars collection for the active Explorer object:

Dim cbrExplorerBars As CommandBars
Set cbrExplorerBars = ActiveExplorer.CommandBars

You can use the GetExplorerInfo and GetInspectorInfo procedures to see sample code that uses the Explorer and Inspector objects to get information about what is displayed in the active Outlook Explorer and Inspector objects, including information about built-in and custom command bars. These procedures are available in the modOutlookExplorerAndInspector module in OutlookSamples.mdb in the ODETools\V9\Samples\OPG\Samples\CH05 subfolder on the Office 2000 Developer CD-ROM. Figure 5.3 illustrates the kind of information you can get from an Explorer object.

Figure 5.3 Information Returned by the GetExplorerInfo Procedure