OLE objects in DataWindow objects

The preceding sections discuss the automation interface to OLE controls and OLE objects. You can also use scripts to change settings for an OLE object embedded in a DataWindow object, and you can address properties of the external OLE object.

This section describes how to use the Object property in dot notation to set DataWindow properties and issue automation commands for OLE objects in DataWindow objects.

Naming the OLE object

To use dot notation for the OLE object, give the object a name. You specify the name on the General page in the object’s property sheet.

Setting properties

You set properties of the OLE container object just as you do for any object in the DataWindow object. The Object property of the control is an interface to the objects within the DataWindow object.

For example, this statement sets the Pointer property of the object ole_word:

dw_1.Object.ole_word.Pointer = "Cross!"

It is important to remember that the compiler does not check syntax after the Object property. Incorrect property references cause runtime errors.

For more information about setting properties, handling errors, and the list of properties for the OLE DWObject, see the DataWindow Reference.

NoteOLE objects and the Modify function You cannot create an OLE object in a DataWindow object dynamically using the CREATE keyword of the Modify function. The binary data for the OLE object is not compatible with Modify syntax.

Functions and properties

There are four functions you can call for the OLE DWObject. They have the same effect as for the OLE control. They are:

To call the functions, you use the Object property of the DataWindow control, just as you do for DataWindow object properties:

dw_1.Object.ole_word.Activate(InPlace!)

Four properties that apply to OLE controls in a window also apply to the OLE DWObject.

Table 19-7: Properties that apply to OLE controls and DWObject

Property

datatype

Description

ClassLongName

String

(Read-only) The long name for the server application associated with the OLE DWObject.

ClassShortName

String

(Read-only) The short name for the server application associated with the OLE DWObject.

LinkItem

String

(Read-only) The entire link name of the item to which the object is linked.

For example, if the object is linked to C:\FILENAME.XLS!A1:B2, then LinkItem would contain C:\FILENAME.XLS!A1:B2.

ObjectData

Blob

If the object is embedded, the object itself is stored as a blob in the ObjectData property.

If the object is linked, this property contains the link information and the cached image (for display).

Automation

You can send commands to the OLE server using dot notation. The syntax involves two Object properties:

The syntax is:

dwcontrol.Object.oledwobject.Object.{ serverqualifiers. }serverinstruction

For example, this statement uses the WordBasic Insert function to add a report title to the beginning of the table of data in the Word document:

dw_1.Object.ole_word.Object.application.wordbasic.&
   Insert("Report Title " + String(Today()))