result = object1 IS object2

Compares two object reference variables.

object1The first object.
object2The second object.

* This is an operator.
* It does not compare Objects or their values.
* This only checks to determine if two references refer to the same object.
* This determines if both object references point to the same object.
* The IsNot is not available in VBA (only VB.Net)
* This operator will attempt to coerce both operands into an Object before performing the comparison.
* If either side is a primitive type or a Variant that does not contain an object (either a non-object subtype or vtEmpty), the comparison will result in a Run-time error 424 - "Object required".
* If either operand belongs to a different interface of the same object, the comparison will return True.
* If you need to test for equity of both the instance and the interface, use ObjPtr(left) = ObjPtr(right) instead.
* You can use the TYPEOF operator to return the data type of an object.
* For the Microsoft documentation refer to

If (oMyObject Is Nothing) Then 
   Set oObject = Nothing
End If

Do While Not object Is Nothing

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top