ObjectSetProperty function
Syntax
ObjectSetProperty(obj_this, str_property_name, val [, index_param_list])
Description
Use the ObjectSetProperty function to set the value of a property str_property_name of the object obj_this to val.
The object must have already been instantiated, either using CreateObject or another function or method that returns an object.
Note:
Default OLE Automation object properties are not supported. You must specify the object property that you want to set explicitly.
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_property_name |
A string containing the name of an exposed property of obj_this. |
|
val |
str_property_name is set to this value. |
|
index_param_list |
A comma-separated list of parameters for accessing an OLE automation object indexed property. (This is only used with COM/OLE objects.) |
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);