VBA360 — Module-only declaration inside a procedure body¶
Severity: 🔴 error Category: placement Phase: 3.5
Description¶
Type, Enum, Declare, Option, Implements and the DefInt/DefStr/… family are only legal at module scope. VBE refuses to compile a Sub/Function/Property that contains one of these declarations.
Failing example¶
Compliant example¶
How to fix¶
Move the declaration outside any procedure, between the module attributes and the first Sub/Function.
Source: src/rules.py — entry VBA360.