CoCimSafeArray5.SetObjectPropertyEx (method)

Sets a named property of another COM object with the internal array of this object.
Syntax: object.SetObjectPropertyEx Object, PropertyName, InputArguments
Parameters:
Object As object -
PropertyName As String -
InputArguments As SAFEARRAY(VARIANT)* -
Description: Sets the named property of the passed object with the value contained in this object passing remaining arguments to the object. The passed COM object must implement IDispatch for this method to work. If the contained array only has one dimension and one element the type library of the passed object will be queried to determine if the named property is an array type. If it is not an array the property is set with the value of the only element in the array. In all other cases the property is set with the array.. The third parameter listed (InputArguments) in this method is actually a mechanism for passing a variable argument list. The scripting syntax for passing the argument list is to just use normal argument passing syntax as demonstrated in the example. Basic Scripts normal calling convention is to pass everything ByRef. Some automation servers do not handle these ByRef parameters well. If problems seem to occur try passing the parameters using ByVal as demonstrated in this example.

Example:

Private cimOleObj As Object
 
 
Sub OnScreenOpen()
  cimOleObj.Cols = 4
 
  Dim csa As CoCimSafeArray5
 
  Set csa = CreateObject("CIMPLICITY.CimSafeArray.5")
    
  csa.CreateVector cimVLong, 0, 1
       
  Dim colID As Long
 
 
  For colID = 0 To cimOleObj.Cols - 1
    csa.SetVectorElement 0, (1500 + colID * 15)
    csa.SetObjectPropertyEx cimOleObj, "ColWidth", ByVal colID
  Next colID
   
  For colID = 0 To cimOleObj.Cols - 1
    csa.GetObjectPropertyEx cimOleObj, "ColWidth", ByVal colID
   MsgBox csa.Element(0)
  Next colID
     
End Sub
See Also: SetObjectProperty , GetObjectProperty , GetObjectPropertyEx