Inspection Details

ModuleScopeDimKeyword


Summary
Warns about module-level declarations made using the 'Dim' keyword.
Reasoning
Private module variables should be declared using the 'Private' keyword. While 'Dim' is also legal, it should preferably be restricted to declarations of procedure-scoped local variables, for consistency, since public module variables are declared with the 'Public' keyword.
The following code example(s) would trigger this inspection:

Option Explicit
Dim foo As Long
' ...

The following code example(s) would not trigger this inspection:

Option Explicit
Private foo As Long
' ...


Back to List