Implicit Active Workbook Reference
Locates unqualified Workbook.Worksheets/Sheets/Names member calls that implicitly refer to ActiveWorkbook.
Reasoning
Implicit references to the active workbook rarely mean to be working with *whatever workbook is currently active*. By explicitly qualifying these member calls with a specific Workbook object, the assumptions are removed, the code is more robust, and will be less likely to throw run-time error 1004 or produce unexpected results when the active workbook isn't the expected one.
Default severity
Warning
Inspection type
LanguageOpportunities
This inspection will only run when the Excel library is referenced
Examples
This example should trigger a result
This example should NOT trigger a result
Rubberduck.CodeAnalysis.Inspections.Concrete.ImplicitActiveWorkbookReferenceInspection.cs (Prerelease-v2.5.9.6289)