OLE Automation is a standard, promoted by Microsoft, that applications use to expose their OLE objects to development tools,
BlueZone Basic, and containers that support OLE Automation. A spreadsheet application can expose a worksheet, chart, cell,
or range of cells all as different types of objects. A word processor can expose objects such as application, paragraph, sentence,
bookmark, or selection.
When an application supports OLE Automation, the objects it exposes can be accessed by BlueZone Basic. You can use BlueZone
Basic to manipulate these objects by invoking methods on the object, or by getting and setting the object’s properties, just
as you would with the objects in BlueZone Basic. For example, if you created an OLE Automation object named
MyObj, you can write code such as this to manipulate the object:
Sub Main
Dim MyObj As Object
Set MyObj = CreateObject ("Word.Basic")
MyObj.FileNewDefault
MyObj.Insert "Hello, world."
MyObj.Bold 1
End Sub
The following syntax is supported for the
GetObject function:
Set MyObj = GetObject ("", class)
Where class is the parameter representing the class of the object to retrieve. The first parameter at this time must be an empty string.
The properties and methods an object supports are defined by the application that created the object. See the application's
documentation for details on the properties and methods it supports.
Accessing an object
The following functions and properties allow you to access an OLE Automation object.
Table 7: Functions and properties to access OLE Automation objects
Name |
Description |
CreateObject |
Function Creates a new object of a specified type. |
GetObject |
Function Retrieves an object pointer to a running application. |