O'Reilly logo

VBScript in a Nutshell by Ron Petrusha, Paul Lomax, Matt Childs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Outlook Object Model

Although VBScript allows you only to program an Outlook form, it nevertheless gives you relatively complete access to the Outlook object model, which is shown in Figure 6.6. Since the object model is fairly large, we’ll focus only on some of its highlights here, and in particular on those objects that you are most likely to use when programming an Outlook form. You can explore the Outlook object model by opening the object browser in the VBScript editor, or by using the Object Browser included with the VBA integrated development environment.

The Outlook 2000 object model

Figure 6-6.  The Outlook 2000 object model

Note that when you’re attempting to access the Outlook object model using VBScript, the context of your script is the current item, which can be represented by the Item keyword. In other words, as your script is executing, the Item object is the current object; to access other objects in the object model, you have to navigate to them from the Item object.

This also means that a reference to the current item is assumed in any attempt to navigate the object model or access a particular object, property, or method. For example, the code:

MsgBox Item.Application.Version

is identical to the code:

MsgBox Application.Version

This second line of code is interpreted as an attempt to retrieve the value of the Application object of the current item, and to retrieve its Version property.

If you’re ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required