I'm trying to extend functionality of the VBA Collection
object in a new class and make this class an inheritant of Collection
, but the Implements Collection
statement gives me the following error:
Bad interface for Implements: method has underscore in its name.
What underscore?! Add
, Item
, Remove
, and Count
are the only methods listed in the documentation for Collection
. All four are underscore-free.
EDIT: To clarify, I'm making a class called UniformCollection
(that only accepts members that are all of the same type, inspired by this approach). I'd like it to implement Collection
, so that a UniformCollection
is a Collection
and can be used in place of a Collection
when calling other objects' methods, etc.
I know I have to write delegating methods/properties for Add, Item, etc., and a NewEnum property for For Each
to work, and I've done so already.
My problem is that the Implements Collection
statement gives me the error stated above.
Bonus question: is Count
a method or a property of Collection
? Help calls it a property, but the Object Browser in the VBA editor calls it a function i.e. method (flying yellow box).
TextStream
). I think @Dick is right that it's the hidden methods/properties that are preventing this forCollection
. I've never tried to do this and I never did much with "real" VB or behind the scenes COM stuff, so I don't really know. – Trippet