Table of contents
Collapse the table of content
Expand the table of content

Understanding Automation

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Automation (formerly OLE Automation) is a feature of the Component Object Model (COM), an industry-standard technology that applications use to expose their objects to development tools, macro languages, and other applications that support Automation. For example, a spreadsheet application may expose a worksheet, chart, cell, or range of cells — each as a different type of object. A word processor might expose objects such as an application, a document, a paragraph, a sentence, a bookmark, or a selection.

When an application supports Automation, the objects the application exposes can be accessed by Visual Basic. Use Visual Basic to manipulate these objects by invoking methods on the object or by getting and setting the object's properties. For example, you can create an Automation object named and write the following code to access the object:

MyObj.Insert "Hello, world." ' Place text. 
MyObj.Bold = True ' Format text. 
If Mac = True ' Check your platform constant 
 MyObj.SaveAs "HD:\WORDPROC\DOCS\TESTOBJ.DOC" ' Save the object (Macintosh). 
 MyObj.SaveAs "C:\WORDPROC\DOCS\TESTOBJ.DOC" ' Save the object (Windows). 

Use the following functions to access an Automation object:

CreateObjectCreates a new object of a specified type.
GetObjectRetrieves an object from a file.

For details on the properties and methods supported by an application, see the application documentation. The objects, functions, properties, and methods supported by an application are usually defined in the application's object library.

© 2018 Microsoft