Sign in with Microsoft
Sign in or create an account.
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Returns a Boolean value indicating whether an identifier (Visual Basic) represents an object variable.


IsObject ( identifier )

The required identifierargument is a variable name.


IsObject is useful only in determining whether a Variant is of VarTypevbObject. This could occur if the Variant actually references (or once referenced) an object, or if it contains Nothing.

IsObject returns True if identifier is a variable declared with object type or any valid class type, or if identifier is a Variant of VarTypevbObject, or a user-defined object; otherwise, it returns False. IsObject returns True even if the variable has been set to Nothing.

Use error trapping to be sure that an object reference is valid.


Note: Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.

This example uses the IsObject function to determine if an identifier represents an object variable. MyObject and YourObject are object variables of the same type. They are generic names used for illustration purposes only.

' Declare variables.
Dim MyInt As Integer, YourObject, MyCheck
Dim MyObject As Object
Set YourObject = MyObject ' Assign an object reference.
MyCheck = IsObject(YourObject) ' Returns True.
MyCheck = IsObject(MyInt) ' Returns False.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!