Description

Returns a “temporary” McObject that contains given source data.

Return Type

A McObject object.  

A McObject instance. If varValue already holds an McObject, then that is returned. Otherwise a new McObject instance is returned; this instance will not be part of the McObjects collection, so it will be destroyed as soon as it is Released.

Syntax

object.McObjectTemp (varValue)

The McObjectTemp Method syntax has these parts:

PartDescription
objectAn expression evaluating to an object of type McOMGlobal.
varValueRequired. A Variant value.

An intial value to be assigned to the object. The type of this argument determines the type of the object. The varValue VARIANT must not be empty. Any default Value of an object source will be used as the source data.

Remarks

If the source data is already an McObject, then it is just returned. Otherwise, if the source data is some dual or dispinterface, then any default Value (DISPID_VALUE) is accessed (this process is recursive, if necessary) as the source data. Finally, a new, unnamed “temporary” McObject is created.

A new McObject created by this method is not part of the McObjects collection; it will be destroyed as soon as the last reference on the returned McObject is Released.

The type of a newly created McObject depends on the Variant type of the varValue source data Variant argument.

A newly created McObject will be unnamed and have no ParentMcObject. And it will not be part of the McObjects collection, so it cannot be looked up via the Item property nor will it appear in any enumeration.

If the source data is some dual or dispinterface, then any default Value (DISPID_VALUE) is accessed as the source data, thus if such a default Value is available, the temporary McObject will not be of type mcobjTypeXOBJECT or a derived type.

If any of this is a problem, call the McObjects.Add method directly to create a McObject instance that is part of the collection, with the properties that you desire. You may then use the McObject.RemoveFromCollection method to remove that instance from the collection, effectively making it a “temporary” object.