Chapter 5. Automation

In this chapter, you will see how VB can take advantage of the power of OLE automation to extend the capabilities of any VB application. While you will see Microsoft Office applications acting as OLE automation servers, this technology isn't restricted to Microsoft Office applications; there are now hundreds of applications that can be used in this way, allowing you either to program within the application itself using its VBA development environment or to use a VB/VBA program to control the OLE automation application from outside.

The key to controlling an OLE automation application is a firm understanding of the application's object model. Each application's object model is different, and the amount of control you have over the application varies considerably. Microsoft now claims that every function of every application in the Office suite is available to the developer via the application's object model.

The object model is a hierarchy of objects that contain the methods, properties, and events that control the application. It acts to describe the application to you, the developer. Once you have become familiar with one or two object models, you will find that, in general, you can quickly pick up the basics of other object models you come across.

Get VB & VBA in a Nutshell: The Language 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.