Skip to content

Commit 2aae8fc

Browse files
committed
Fix scoping of Implicit Active Workbook Reference Inspection
1 parent 330423b commit 2aae8fc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

RetailCoder.VBE/Inspections/ImplicitActiveWorkbookReferenceInspection.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public ImplicitActiveWorkbookReferenceInspection(VBE vbe, RubberduckParserState
2727
"Worksheets", "Sheets", "Names",
2828
};
2929

30+
private static readonly string[] ParentScopes =
31+
{
32+
"EXCEL.EXE;Excel._Global",
33+
"EXCEL.EXE;Excel._Application"
34+
};
35+
3036
public override IEnumerable<InspectionResultBase> GetInspectionResults()
3137
{
3238
if (_hostApp == null || _hostApp.ApplicationName != "Excel")
@@ -35,7 +41,7 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
3541
// if host isn't Excel, the ExcelObjectModel declarations shouldn't be loaded anyway.
3642
}
3743

38-
var issues = BuiltInDeclarations.Where(item => item.ParentScope.StartsWith("EXCEL.EXE;")
44+
var issues = BuiltInDeclarations.Where(item => ParentScopes.Contains(item.ParentScope)
3945
&& Targets.Contains(item.IdentifierName)
4046
&& item.References.Any())
4147
.SelectMany(declaration => declaration.References);

0 commit comments

Comments
 (0)