USING AUTOMATION

Before using Automation, you need to set up references to the various applications' object libraries, also known as TypeLibs. By setting up references, you can strongly type variables (so that you can use data types such as Sheet and Chart instead of Object), get early binding, and use constants defined in the TypeLib. (Declaring Automation variables is described in more detail in the next section, “Declaring Object Variables in VBA.”)

Suppose that you want to set a reference to the Microsoft Word 9.0 TypeLib. In the database where you want to set up a reference, open the module editor with any module, and then follow these steps:

1.
In the VBE, open the Tools menu and choose References.
2.
Select Microsoft Word 9.0 Object ...

Get F. Scott Barker's Microsoft® Access 2000 Power Programming 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.