OLE objects in DataWindow objects
Contents
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:
1 |
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 section called “Properties for OLE Object controls in DataWindow
objects” in DataWindow Reference.
OLE 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:
-
Activate
-
Copy
-
DoVerb
-
UpdateLinksDialog
To call the functions, you use the Object property of the
DataWindow control, just as you do for DataWindow object
properties:
1 |
dw_1.Object.ole_word.Activate(InPlace!) |
Four properties that apply to OLE controls in a window also apply
to the OLE DWObject.
Property |
datatype |
Description |
---|---|---|
ClassLongName |
String |
(Read-only) The long name for the server |
ClassShortName |
String |
(Read-only) The short name for the server |
LinkItem |
String |
(Read-only) The entire link name of the item to For example, if the |
ObjectData |
Blob |
If the object is embedded, the object itself is If the |
Automation
You can send commands to the OLE server using dot notation. The
syntax involves two Object properties:
-
The Object property of the DataWindow control
Gives you access to DataWindow objects, including the OLE
container DWObject -
The Object property of the OLE DWObject
Gives you access to the automation object
The syntax is:
1 |
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:
1 2 |
dw_1.Object.ole_word.Object.application.wordbasic.& Insert("Report Title " + String(Today())) |