Ambiguous name detected
The identifier conflicts with another identifier or requires qualification. This error has the following causes and solutions:
- More than one object in the same scope may have elements with the same name.
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
is declared at the module level ofMyID
, 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:MyModuleDim 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
- An identifier declared at module-level conflicts with a procedure name. For example, this error occurs if the variable
is declared at module level, and then a procedure is defined with the same name:MyIDPublic MyID Sub MyID . . . End SubIn 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).