The identifier conflicts with another identifier or requires qualification. This error has the following causes and solutions:
Qualify the element name by including the object name and a period. For example:
object.property
Module-level identifiers and project-level identifiers (module names and referenced project names) may be reused in a procedure, although it makes programs harder to maintain and debug. However, if you want to refer to both items in the same procedure, the item having wider scope must be qualified. For example, if MyID
is declared at the module level of MyModule
, and then a procedure-level variable is declared with the same name in the module, references to the module-level variable must be appropriately qualified:
Dim MyID As String
Sub MySub
MyModule.MyID = "This is module-level variable"
Dim MyID As String
MyID = "This is the procedure-level variable"
Debug.Print MyID
Debug.Print MyModule.MyID
End Sub
MyID
is declared at module level, and then a procedure is defined with the same name:
Public MyID
Sub MyID
. . .
End Sub
In this case, you must change one of the names because qualification with a common module name would not resolve the ambiguity. Procedure names are Public by default, but variable names are Private unless specified as Public.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).