Adds a parameter to an advanced method call for a COM object.


Result = SRP_Com(Object, "ADDPARAM", Type, Value)


TypeThe type of parameter being added. Can be set to "Object", "Omitted", or "Value".
ValueThe value being added.


Always returns 1.


Added in 2.2.6

The ADDPARAM gives you fine tuned control over how a COM method is called. The normal CALL service is useful when passing simple values. This service can only be used between the BEGINCALL and ENDCALL services. Each call to this service adds exactly one parameter to the method call in the order in which you call this service. There are three behaviors you can apply as determined by the value you pass to the Type parameter: "Object", "Omitted", or "Value". The behavior will determine how the Value parameter is treated.

"Object"Specify this type when need to pass an object. The Value parameter must be an SRP_COM object handle. Note: You can omit the Value parameter or set Value to "" or "NULL" to pass a null object reference.
"Omitted"Specify this type when you want to truly omit the parameter. The Value parameter is ignored.
"Value"Specify this type when you want to pass a simple value. This behavior is the same as the CALL service.


Here is a real world use case. In the Excel object model, there is a ListObjects class. You can add a variety of Excel objects to this class, and if you add a Range to it, there is a parameter that you must omit or the method will fail. This means we need that ability to pass an object and omit a parameter. The CALL service can't do this for us, so we'll use BEGINCALL...ENDCALL instead.

Equ xlSrcRange$             to 1
Equ xlNo$                   to 2
Equ xlYes$					to 1

// Because we have object references and omitted parameters, we need to do this call the long way
SRP_Com('', 'BEGINCALL')			
SRP_Com('', 'ADDPARAM', 'Value', xlSrcRange$)
SRP_Com('', 'ADDPARAM', 'Object', objRange)     ; // this is a handle to range object we made earlier
SRP_Com('', 'ADDPARAM', 'Omitted')
SRP_Com('', 'ADDPARAM', 'Value', xlYes$)
objListObject = SRP_Com(objListObjects, 'ENDCALL', 'Add')
  • No labels