Rubberduck version information
Version 2.4.1.5196
OS: Microsoft Windows NT 10.0.17763.0, x64
Host Product: Microsoft Office 2016 x64
Host Version: 16.0.4912.1000
Host Executable: EXCEL.EXE
Description
RD inspection flags "Set assignment with incompatible object type" error when setting an Excel.Worksheet variable with an Excel.Worksheet codename. This wasn't always flagged by RD in the past though I'm not sure when it started.
The code below looks clean to me. Is this intentionally flagged?
To Reproduce
Steps to reproduce the behavior:
Private Sub test()
Dim ws As Excel.Worksheet
Set ws = Sheet2
Debug.Print TypeName$(Sheet2)
End Sub
This is a long-standing resolver issue that I wish we could fix before releasing 2.5.0, now that we have what it takes to fix it (namely, identifying the base class for document modules, via the TypeLib API).
Until then, RD doesn't know that Sheet1 is a Worksheet, or that ThisWorkbook is a Workbook.
Endless possibilities...Does that also cover the possibility that document module Chart1 could be a chart object?
Yes