There are two syntax forms when you call object methods:
Syntax 1:
<Objektmethode> = <Variable>
Syntax 2:
<Objektmethode> <Exportvariable 1>.. <Exportvariable 5>
<Objektmethode> is a name defined by the OLE application, whereas <Variable>, <Exportvariable 1>.. <Exportvariable 5> represents 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:
Call an object method with an import variable
Create a new (sub-)object from the current object.
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
Subobjects
You can also call object methods that do not refer to the global object but to a subobject of the application. This object must first be created. Then the properties can also be edited there. The corresponding syntax is then:
<Objekt>.<Objektmethode> = <Variable>
or
<Objekt>.<Objektmethode> <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". Subobjects 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 method open of 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.