Introduction to Automation

Introduction to Automation

The CDO Library is based on the capabilities provided by Automation. The CDO Library allows you to create instances of programmable messaging objects that you can reference with automation controllers. An automation controller is a tool that supports Automation, such as Microsoft® Visual Basic®.

For the purposes of this document, an object is an Automation object: a software component that exposes its properties and methods. Such an object follows the Visual Basic programming model and lets you get properties, set properties, and call methods.

You can think of programmable objects as additions or extensions to the programmable objects that are offered as part of Visual Basic, such as forms and controls. Forms and controls expose their properties and methods so that developers can tailor these objects for the needs of their programs. In addition to the forms and controls, Visual Basic allows for the definition of a wide variety of other programmable objects by providing the CreateObject and LoadObject functions. Note that these functions do not have specialized names like CreateSpreadsheet or LoadDatabase. They are general-purpose functions that enable an open-ended number of programmable objects, including the CDO Library.

Throughout this document, Visual Basic is used as a concrete example of an automation controller, but the statements about Visual Basic apply to all such tools.

Visual Basic scripts drive the CDO Library. The scripts can also drive other libraries that support Automation, such as the libraries of programmable objects provided by Microsoft® Excel version 5.0 and Microsoft® Access version 2.0. Visual Basic can call many different programmable object libraries and can act as the glue that holds all of these objects together.

Each library can create its own objects, set properties, and call methods. The Visual Basic program coordinates the work of all the libraries. For example, it can direct the Microsoft® Access object to find data in a specific table, direct the Microsoft Excel object to run calculations using that data, and then direct CDO Library objects to create a message containing the results of those calculations and send the message to several recipients.