Understanding Office Objects and Object Models

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Each Microsoft Office application contains a powerful set of tools designed to help you accomplish a related set of tasks. For example, Microsoft Access provides powerful data-management and query capabilities, Microsoft Excel provides mathematical, analytical, and reporting tools, Microsoft Outlook provides tools for sending and receiving e-mail, for scheduling, and for contact and task management, and Microsoft Word lets you create and manage documents, track versions of documents among different users, and create forms and templates. As powerful as these and the other Office applications are on their own, you can also integrate the features from two or more Office applications into a single solution to amplify and focus users' productivity.

The key technology that makes individual Office applications programmable and also makes creating an integrated Office solution possible is the Component Object Model (COM) technology known as Automation (formerly called OLE Automation). Automation allows a developer to use Visual Basic for Applications (VBA) code to create and control software objects exposed by any application, dynamic-link library (DLL), or ActiveX control that supports the appropriate programmatic interfaces. VBA and Automation allow you to program individual Office applications, for example, to create procedures to automatically create and format documents in Word itself, as well as to run other applications from within a host application. For example, you can run a hidden instance of Excel from within Access to perform mathematical and analytical operations on your Access data. The key to understanding Automation is to understand objects and object models: what they are, how they work, and how they work together. This chapter and Chapter 5, "Working with Office Applications," provide a solid foundation on which to build your understanding of developing custom Office solutions.

To fully master the use of Automation in your Office solutions, you must have detailed working knowledge of the applications you are integrating. It is not the purpose of this chapter, indeed of this book, to teach you all you need to know about any specific Office application. That is the kind of knowledge and experience that can only be gained with further application-specific training and hands-on experience.

Contents

Developing Integrated Office Solutions

Understanding Objects and Collections

Automating Other Office Applications

Where to Go from Here