Enum ImplicitDeclarationScope
Where the variable a reference to an undeclared name implicitly declares lives.
public enum ImplicitDeclarationScope
Fields
Module = 1A module-level
Variantof the module that refers to the name, shared by every procedure of it and kept for as long as the session is.Procedure = 0A local of the procedure that refers to the name: MS-VBAL §5.6.10, and VBA's behavior.
Remarks
MS-VBAL §5.6.10 has such a name declare a local variable of the procedure it is written in, "as if by a local variable declaration statement immediately preceding" the statement — which is what Procedure is. It is also the reason a value assigned to an undeclared name does not outlive the procedure that assigned it.
Module is how a BASIC works: every variable is global, so a name assigned in one line is the same variable in the next, and a program's variables can be looked at after it has run. It is a dial of the environment rather than of a module — a language server serving an interactive shell turns it on — and it changes nothing about a name that is declared, only where an undeclared one is declared.
👉 Neither mode applies under Option Explicit, where an undeclared name is a compile error.