References to properties and methods often require an explicit object qualifier. This error has the following causes and solutions:
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.
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.
An incorrect path as an argument to a host application's File Open command could cause the error. Check arguments.
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 RetVal
as 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.
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 (in Windows) or HELP (on the Macintosh).