Executes an advanced set property for a COM object.
Syntax
Result = SRP_Com(Object, "ENDSET", PropertyName)
Parameters
Parameter | Description |
---|---|
PropertyName | The name of the property to set. |
Returns
1 if succeeded, 0 if failed.
Remarks
Added in 2.2.13
The ENDSET allows you to set properties while having more control. The normal SET service only allows you to pass values. However, some COM properties can be picky on how their value is set. In those cases, you will use this service to begin a multi-step process that includes this service along with the BEGINSET and ADDPARAM services. This is always the final step in the process. First you must use the BEGINSET service followed by ADDPARAM.
Example
Here is a real world use case. In the Excel object model, the NumberFormat property expects a string of characters to indicate how to format the cell's contents. If try setting it to "000" via the SET service, SRP_COM will convert that into an integer. We can use the BEGINSET service to force it into a string
// Set the NumberFormat property to a string SRP_Com('', 'BEGINSET') SRP_Com('', 'ADDPARAM', 'String', '000') objListObject = SRP_Com(obj, 'ENDSET', 'NumberFormat')