Table of Contents

VBC09303 — Duplicate declaration in current scope

Severity: Error  ·  Family: VBC (static semantics / abstract syntax tree)  ·  Source metadata: VBCompileErrorInfo

A name is declared more than once at one level of scope.

MS-VBA reports the same error: Duplicate declaration in current scope. A type-declaration character is how a type is said and not a different name: x$ and x% are both x. A name a module declares twice is VBC09301, as MS-VBA has it.

This code is raised by DeclarationStaticSemanticsEvaluator, StatementStaticSemanticsEvaluator, ClassModuleEventSemantics.

How it is raised

Situation Example Resolution
A procedure declares a name twice: its parameters, variables and constants share one scope. Dim x$ and Dim x% Rename or remove one.
A #Const is declared twice in a module. #Const Flag = 1 and #Const Flag = 0 Declare it once.

See also


⏮️ VBC09302 Variable not defined | ⏭️ VBC09304 Invalid use of object


ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca