ObjectDoMethod function
Syntax
ObjectDoMethod(obj_this, str_method_name [, paramlist])
Where paramlist is a list of parameters of arbitrary length:
param1 [, param2]. . .
Description
Use the ObjectDoMethod function to invoke the method specified by str_method_name for the object object_this, passing in any required parameters using paramlist.
You can use ObjectDoMethod with Component Interfaces, Application Classes, OLE Automation objects, and so on.
This method can be useful if you know the number of parameters you need to pass for a method. If you do not know how many parameters you may need to pass when you write your PeopleCode, use the ObjectDoMethodArray function.
Parameters
| Parameter | Description |
|---|---|
|
obj_this |
Specify an already instantiated object. This variable must have been instantiated either with CreateObject, or another function or method that creates objects. |
|
str_method_name |
A string containing the name of an exposed method of obj_this. |
|
paramlist |
The parameter list to pass to the str_method_name method. |
Returns
None.
Example
This simple example instantiates an Excel worksheet object, makes it visible, names it, saves it, and displays its name.
&WORKAPP = CreateObject("Excel.Application");
&WORKBOOKS = ObjectGetProperty(&WORKAPP, "Workbooks");
ObjectDoMethod(&WORKBOOKS, "Add", "C:\TEMP\INVOICE.XLT"); /* This associates the⇒
INVOICE template w/the workbook */
ObjectDoMethod(&WORKAPP, "Save", "C:\TEMP\TEST1.XLS");
ObjectSetProperty(&WORKAPP, "Visible", True);
This simple example invokes a user-defined method associated with the current component interface object:
ObjectDoMethod(%CompIntfcName, &inMethodName);