RDC00305 — Obsolete Global modifier
Severity: Information · Family: RDC (Rubberduck Core analyzers) ·
Raised by: ObsoleteGlobalModifierAnalyzer
A variable or a constant is declared Global.
A Global declaration is a Public one (MS-VBAL §5.2.3 Module Declarations): the grammar accepts either keyword for a
variable and for a constant of a module, and they declare the same thing. Public is the keyword that is also used for procedures, types and enumerations, and the one the
language kept. The diagnostic is an opinion of the analyzer and not a condition of the language: both are legal VBA. It is reported for every language, though it may not mean the
same in all of them: Global is Public in VBA, and the analyzer makes no claim about VB6.
One finding is made for each statement, however many names it declares, and it is the keyword. It is a suggestion because Public does not change what the declaration is.
How it is raised
| Situation | Example | Resolution |
|---|---|---|
A module-level variable or constant is declared Global. |
Global Total As Long |
Declare it Public. |
See also
ACCUEIL • HOME | ℹ️ BIENVENUE • WELCOME | 🧩 BÂTISSONS • BUILD | RD-VBAL | SDK | 🌐 rubberduckvba.ca