Well the mcolEmployees has For:Each capabilities, but since your collection is in a class, and the class is a wrapper for the collection, you have no way of exposing the collection's For:Each ability, other than exposing the collection itself which you wouldn't normally want to do. You don't want the user directly manipulating your class' collection. If you did, it would work like this
Edited: By using For:Each, yes the user is directly manipulating your class' collection. However, by exposing the class thru a property, the user could do horrible things like: Set Class1.Collection = Nothing, or setting it to another collection entirely.Code:Pubic Property Get TheCollection() As Collection Set TheCollection = mcolEmployees End Property ' then the user can do Dim V As Variant For Each V In Class1.TheCollection .... Next




Reply With Quote