Option Explicit

Flags modules that omit Option Explicit.


This option makes variable declarations mandatory. Without it, a typo gets compiled as a new on-the-spot Variant/Empty variable with a new name. Omitting this option amounts to refusing the little help the VBE can provide with compile-time validation.

Default severity


Inspection type



This example should trigger a result

MyModule (StandardModule)
Public Sub DoSomething() ' ... End Sub

This example should NOT trigger a result

MyModule (StandardModule)
Option Explicit Public Sub DoSomething() ' ... End Sub

Rubberduck.CodeAnalysis.Inspections.Concrete.OptionExplicitInspection.cs (Prerelease-v2.5.9.6289)