Why do I get a type mismatch running sub bar
below in Excel VBA?
Sub foo(c As Collection)
Debug.Print c.Count
End Sub
Sub bar()
Call foo(Worksheets)
End Sub
The code above is a minimal working example intended to focus only on the Type related issues. The origin of this question is that, at some point, the code from This existence test for a member of a collection worked, but now I get the same type mismatch described in this question.
I wonder what detail is causing the type confusion. Is Worksheets
not a Collection
?