Visual Studio Tools for Office: Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath
The inspector window is the window in Outlook that shows detailed information for a particular Outlook item. This is the window that displays when you double-click an item in an Outlook folder. You can have multiple inspector windows open at any time. Working with the Outlook Item Associated with the Inspector
An inspector window is always associated with 1 of the 16 Outlook item types listed in Table 10.1 in Chapter 10, "Working with Outlook Events." To get to the Outlook item associated with an Inspector object, use the CurrentItem property, which returns an Outlook item as an Object. You can cast the returned Object to 1 of the 16 Outlook item types. Working with an Inspector Window
Table 11.5 lists several properties and methods that are used to set and get the position of an inspector window, as well as some other commonly used properties and methods related to the management of the window.
Working with Different Inspector Editor Types
In the Mail Format tab of Outlook's Options dialog box, users can set preferences for what kind of formats and editor they want to use when editing an Outlook item. The Options dialog box, shown in Figure 11.6, can be accessed using the Options menu command in the Tools menu. Two key options are what message format to use (HTML, Rich Text, or Plain Text) and whether to use Word as the editor of e-mail messages and rich text. Figure 11.6. Picking formats and editor preferences in the Options dialog box.
These settings help determine what the Inspector object's EditorType property returns. EditorType returns a member of the OlEditorType enumeration: olEditorHTML, olEditorRTF, olEditorText, or olEditorWord. If the EditorType returns olEditorHTML, you can get to the HTML document object model for the inspector window by using the Inspector object's HTMLEditor property. Using the HTML document object model is an advanced topic and is not covered in this book. If the user has chosen to use Word as his editor, the Inspector object's IsWordMail property returns TRue. This means that Outlook has started an instance of Word and is embedding the Word editor in the inspector window. Outlook has also created a Word Document to edit the Outlook item in. You can access Word's Document object by using the WordEditor property. This property returns an Object that you can cast to Word's Document object. Adding Buttons and Menus to an Inspector Window
The Inspector object's CommandBars property returns a CommandBars object, which is defined in the Microsoft Office 11.0 Object Library PIA object. Outlook uses the same object model used by Word and Excel to work with buttons and menus associated with an inspector window. See Chapter 4, "Working with Excel Events," for more information on the CommandBars object hierarchy and examples of using the CommandBar objects. Listing 11.9 shows a simple VSTO add-in that creates a toolbar and a button in an inspector window and handles the click event for the new button. Listing 11.9. A VSTO Add-In That Adds a Toolbar and a Button to an Inspector Window
|
Категории