\<bookmark_value\>EqualUnoObjects function\</bookmark_value\>

EqualUnoObjects Function

Returns True if the two specified Basic variables represent the same Uno object instance.

Syntax:

EqualUnoObjects(oObj1, oObj2)

Parameters:

oObj1, oObj2: the variables to be tested.

Return value:

Bool

Example:

The example below returns True because both oDoc and ThisComponent are references to the same object:


    Dim oDoc as Object
    oDoc = ThisComponent
    MsgBox EqualUnoObjects(oDoc, ThisComponent) ' True
  

The example below returns False because the assignment creates a copy of the original object. Hence Struct1 and Struct2 refer to different object instances.


    Dim Struct1 as new com.sun.star.beans.PropertyValue
    Dim Struct2 as Variant
    Struct1.Name = "John"
    Struct2 = Struct1
    MsgBox EqualUnoObjects(Struct1, Struct2) ' False
    Struct2.Name = "Judy"
    MsgBox Struct1.Name ' John
    MsgBox Struct2.Name ' Judy
  

Please support us!