Chapter 24. Understanding the Outlook Object Model

IN THIS CHAPTER

  • About the Outlook Object Model

  • Creating object references

  • The Object Model hierarchy

  • Referencing Outlook folders

  • Programming email items

  • Programming calendar items

In order to program Outlook with macros, it is necessary to have some understanding of the Outlook Object Model. Though this may sound intimidating, it is actually a great help to the macro programmer and makes your job much easier.

This chapter gives you an overview of programming the Outlook Object Model and presents numerous examples. The focus is on programming mail items and calendar items because it is these two aspects of Outlook that benefit the most from macro programming. The next chapter develops a few of the programming concepts presented here into full VBA applications you can use or modify.

Understanding Office Objects

All Office programs operate on the principle of objects. This means that internally, all the various components of the program are represented by their own kind of object. In Word, for example, a paragraph is an object, a table is an object, and an entire document is an object. In Excel, a worksheet is an object, and charts and cells are objects, too. Outlook works the same way.

From the perspective of the end user, the fact that a program is structured as objects does not make any practical difference. For the macro programmer, however, it makes a world of difference because all the objects are available for you to use in your macros. ...

Get Microsoft® Outlook® 2007 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.