-
Hey, So, when I write something like the following:
I get an inspection for an indexed default member access - but only for
But why not add the
Furthermore, the same thing happens for assignment of values, e.g. to as
while leaving out the I see that the difference is: Using a variable as a base without the default member generates an inspection, while using native classes and methods doesn't. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Let me try to explain what I think is the issue here. This seems to boil down to a peculiarity in the Excel object model. In case you declare your variable as |
Beta Was this translation helpful? Give feedback.
Let me try to explain what I think is the issue here.
This seems to boil down to a peculiarity in the Excel object model. In case you declare your variable as
Range
, Rubberduck knows that it is a range and that the memberCells
has no parameters and just returns the same range with a (potentially) different indexing behaviour. Accordingly, the inspections show up.On the other hand, the
ActiveSheet
function has a declared return type ofObject
; it might return aWorkSheet
or aChartSheet
, which is only known at runtime. Because theObject
type can have arbitrary members, Rubberduck cannot identify that theCells
member does not have parameters and thinks that the standard assumption of a n…