Visual Basic for Applications Reference
See Also Specifics
- You referred to an object property or method, but didn't provide a valid object qualifier.
Specify an object qualifier if you didn't provide one. For example, although you can omit an object qualifier when referencing a form property from within the form's own module, you must explicitly specify the qualifier when referencing the property from a standard module.
- You supplied an object qualifier, but it isn't recognized as an object.
Check the spelling of the object qualifier and make sure the object is visible in the part of the program in which you are referencing it. In the case of Collection objects, check any occurrences of the Add method to be sure the syntax and spelling of all the elements are correct.
- You supplied a valid object qualifier, but some other portion of the call contained an error.
An incorrect path as an argument to a host application's File Open command could cause the error. Check arguments.
- You didn't use the Set statement in assigning an object reference.
If you assign the return value of a CreateObject call to a Variant variable, an error doesn't necessarily occur if the Set statement is omitted. In the following code example, an implicit instance of Microsoft Excel is created, and its default property (the string "Microsoft Excel") is returned and assigned to the Variant
RetVal. A subsequent attempt to use
RetValas an object reference causes this error:
Dim RetVal ' Implicitly a Variant. ' Default property is assigned to Type 8 Variant RetVal. RetVal = CreateObject("Excel.Application") RetVal.Visible = True ' Error occurs here.
Use the Set statement when assigning an object reference.
- In rare cases, this error occurs when you have a valid object but are attempting to perform an invalid action on the object. For example, you may receive this error if you try to assign a value to a read-only property.
Check the object's documentation and make sure the action you are trying to perform is valid.
For additional information, select the item in question and press F1.