How to implement custom iterable class in VBA
The long and short of it is you can't implement IUnknown. The same goes for Collection. They're both Com objects that are unavailable for extension in VBA. You can create custom collections and do other very cool iterable things though.
The answer is that it can be done, but it is ugly (requires and IDL
, two .BAS
modules and two .cls
modules (one of which is your Collection Class module).For full information see this link:
Create Your Own "Super Collections" in VB
Good luck! It seemed to complicated for what I needed to do, so for now I just iterate over the Collection object enumerator.