Inspection Details

UndeclaredVariable


Summary
Warns about implicit local variables that are used but never declared.
Reasoning
If this code compiles, then Option Explicit is omitted and compile-time validation is easily forfeited, even accidentally (e.g. typos).
The following code example(s) would trigger this inspection:

Public Sub DoSomething()
    foo = 42 ' foo is not declared
    ' ...
End Sub

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

Public Sub DoSomething()
    Dim foo As Long
    foo = 42
    ' ...
End Sub


Back to List