Previous Page

CHAPTER  11

Communicating with Other Applications

Microsoft Access makes it easy to communicate with many other Windows components. Microsoft Access supports Automation, formerly called OLE Automation, which is a simple and powerful technology that you can use to work with objects provided by other components. Microsoft Access also supports OLE. With OLE you can link documents created in other components to, or embed them in, your forms and reports. This chapter shows you how to use these technologies to integrate objects and information from other components into your Microsoft Access application.

Integrating Applications by Using Automation and OLE

Automation and OLE provide a sophisticated means for you to work with objects or documents provided by one component from within another component. A component is an application or development tool that makes its objects available to other applications. Not every component supports Automation or OLE, so you should check the other component's documentation to determine whether it does.

Automation and OLE are both features of the Component Object Model, an industry standard used by components to expose their objects to other components and development tools. However, Automation and OLE are two distinct technologies. The following section outlines the differences between the two.

Automation vs. OLE

Automation is a technology that you can use to work with the objects in another component's object model. Automation gives you the same degree of control over a component that you would have if you were programming in the component itself. You can perform Automation only in Visual Basic.

For example, you can write code in Microsoft Access to work with the objects in the Microsoft Word object model. Microsoft Word includes a thesaurus, but Microsoft Access doesn't. You can use Automation from Microsoft Access to look up synonyms in the Microsoft Word thesaurus.

See Also   For more information on object models, see Chapter 5, "Working with Objects and Collections."

OLE is a technology that you can use to include documents created in another component on a Microsoft Access form or report. These documents can be embedded or linked. An embedded object is a copy of a document that is saved with the form or report. Linked objects are documents that exist in another file and are simply displayed on the form or report.

Once you've embedded or linked an object, you can activate the component in which it was created from within Microsoft Access. You can then make changes to the object in its native component. For example, you can embed a Microsoft Word document in a Microsoft Access form. When you double-click the embedded document, Microsoft Word opens and you can edit the document.

A document that can be linked or embedded in a form or report is called an OLE object. OLE objects include different types of documents, such as Microsoft Word and Microsoft Excel documents and Windows Paint pictures. Some multimedia files, such as .avi video clips and .wav sound files, are also OLE objects. OLE objects are different from Automation objects in that they are documents produced by the component rather than a part of the component's object model.

You can perform simple OLE operations without writing Visual Basic code. For a greater degree of control over OLE objects, you can also work with them in Visual Basic.

Some components support both Automation and OLE, so they include both Automation objects and OLE objects. For example, Microsoft Excel documents (.xls files) are OLE objects. You can include a Microsoft Excel document on a Microsoft Access form or report. Microsoft Excel also has an object model that you can use to work with Microsoft Excel in Visual Basic. The Microsoft Excel object model includes Workbook objects, Worksheet objects, Range objects, and so on. You can access these objects from Microsoft Access or from another component that supports Automation.

OLE objects are useful when the user of your Microsoft Access component needs to see and work with data in another component from a form or report. For example, if you want users to be able to make changes to a Microsoft Excel spreadsheet at their discretion, you can embed that spreadsheet in a form.

When you write Automation code, on the other hand, your code controls everything that the other component does. An Automation operation can be completely invisible to the user. For example, Microsoft Excel has a set of powerful built-in mathematical functions. You can use Automation to perform Microsoft Excel's functions on Microsoft Access data without the user ever seeing the Microsoft Excel component.

© 1996 Microsoft Corporation. All rights reserved.

Next Page


Casa de Bender