Skip to content

Perceived inconsistency with "IndexedDefaultMemberAccess" inspection #6078

Answered by MDoerner
Rsge asked this question in Q&A
Discussion options

You must be logged in to vote

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 member Cells 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 of Object; it might return aWorkSheet or a ChartSheet, which is only known at runtime. Because the Object type can have arbitrary members, Rubberduck cannot identify that the Cells member does not have parameters and thinks that the standard assumption of a n…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Rsge
Comment options

Answer selected by Rsge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants