The Visual Editor win

Figure 9.1 - The Visual Basic for Applications Editor window in Outlook 2002. To open the Visual Basic for Applications Editor window

1. On the Explorer or the Inspector Tools menu, click Macro.

2. Click the Visual Basic Editor command, or press Alt+F11 in an Inspector or Explorer window.

You can also customize the Standard and Advanced Outlook toolbars with a toolbar button that launches the Visual Basic Editor. To add a VBA command bar button to the Advanced toolbar for Outlook Explorer, follow these steps:

1. On the Explorer Tools menu, click the Customize command.

2. Click on Advanced Toolbar in the Toolbars list box, and make sure that the Advanced Toolbar is selected.

3. Click the Commands tab in the Customize dialog box.

4. Select Tools in the Categories list box.

5. Select Visual Basic Editor in the Commands list, and then drag the Visual Basic Editor item from the Customize dialog box to any position on the Advanced Toolbar.

6. Click Close to close the Customize dialog box.

ThisOutlookSession Class Module

When the Outlook Visual Basic Editor opens for the first time, you will see only one object, under Projectl, named ThisOutlookSession, as shown in Figure 9-2. While not explicitly identified as such, ThisOutlookSession is a class module rather than a standard module. Although you cannot view its class properties, the Instancing property of ThisOutlookSession is private and the class cannot be instantiated by using CreateObject in another application or with VBScript code running in Outlook forms. The class represented by ThisOutlookSession is the Application object in the Outlook Object Model. The Application object is the parent of all other classes in the Outlook Object Model. All other class objects are derived from the Outlook Application object.

Project Explorer window

Code window for ThisOutloc

>3 Microsoft Visual Basic - Project] - [ThisOutlookSession (Ce le)i

View Insert Formai: Debug Run Tools

Project - Projectl

Was this article helpful?

0 0

Post a comment