There are two syntax forms when you call object methods:
Syntax 1:
<ObjectMethod> = <Variable>
Syntax 2:
<ObjectMethod> <ExportVariable 1>..
<ExportVariable 5>
<ObjectMethod>
is a name defined by the OLE application, whereas <Variable>, <ExportVariable 1>.. <ExportVariable 5> represent the occurrence of transferred variables. Export variables are used for transmitting values to the OLE object (similar to setting object attributes).Syntax Variant 1
From a functional point of view, the syntax variant 1 is a sub-case of the syntax variant 2, because it can transfer only one variable. OLE applications do not provide alternative syntax variants, but generally only provide one form.
The syntax variant 1 allows the following functions:
Determine the current file name in Word:
filename = @DPA
Syntax Variant 2
Syntax variant 2 allows you to call an object method with up to five export variables.
Displaying a local file in Word:
fileopen @DPA
Sub-objects
You can also call object methods that do not refer to the global object but to a sub-object of the application. First create this object, then you can edit the attributes. The corresponding syntax is then:
Syntax:
<Object>.<ObjectMethod> = <Variable>
or.
<Object>.<ObjectMethod>
<ExportVariable 1>.. <ExportVariable 5>
Displaying a file in MS Excel 97:
Excel manages an entire tree structure of objects. The root is the object "Excel.Application". Sub-objects are "Sheet", "Workbook", etc. To address an object, you need to create it from the root. Only then can you edit a method or attribute of this object.
Object name |
Excel.Application |
Description |
Setting attribute |
visible = true |
Setting the object attribute for the root object |
Method 1 |
WORKBOOKS = mywb |
Create the object mywb of type WORKBOOKS |
Method 2 |
mywb.open @DPA |
Call the method OPEN for the object mywb |
Variable Exchange
Unnecessary variables (see list of OLE parameters in
Syntax: OLE Automation) can be used for the variable exchange between OLE calls.