-
Notifications
You must be signed in to change notification settings - Fork 301
OptionExplicitInspection
Max Dörner edited this page Jun 2, 2019
·
3 revisions
Description: Option Explicit is not specified
Type: CodeInspectionType.CodeQualityIssues
Default severity: CodeInspectionSeverity.Warning
This inspection finds modules that do not specify Option Explicit
This module does not specify Option Explicit
Option Private Module
Public Sub DoSomething(foo As Integer)
bar = foo
End Sub
VBA will happily compile and run this code, even though bar
isn't declared anywhere. With Option Explicit
specified, one gets a useful compile-time error about the undeclared variable.
QuickFix: Specify Option Explicit
Option Explicit
Option Private Module
Public Sub DoSomething(foo As Integer)
bar = foo ' compile error
End Sub
This quickfix introduces an Option Explicit
instruction at the top of the faulty code module.
rubberduckvba.com
© 2014-2021 Rubberduck project contributors
- Contributing
- Build process
- Version bump
- Architecture Overview
- IoC Container
- Parser State
- The Parsing Process
- How to view parse tree
- UI Design Guidelines
- Strategies for managing COM object lifetime and release
- COM Registration
- Internal Codebase Analysis
- Projects & Workflow
- Adding other Host Applications
- Inspections XML-Doc
-
VBE Events