2

I have a class with an array field, like this:

Private storage() as Integer
'some logic here

How can i use this class in a For Each loop like the Collection class? Example:

Dim coll as new Collection
Dim value as Variant
For Each value in coll
    'do something
Next value

I know only the decision for a collection type field:

Public Property Get NewEnum() As IUnknown
    Attribute NewEnum.VB_UserMemId = -4
    Set NewEnum = storage.[_NewEnum]    
End Property

Can i make something similar for an array type field?

More accurate, I meant something like applying Iterator interface with a For Each loop in Java.

Roxio0
  • 121
  • 1
  • 4
  • [This](http://stackoverflow.com/questions/9720018/get-an-array-into-a-class-property) might help you – Thomas G Aug 23 '16 at 09:30
  • I might help you more but your question is not accurate enough. You should add more code and what you have tried to retrieve your array's values. The fact that it is a private property implies that you want to make the *get* method to publicly expose the array's values but that is not well enough explained in your question. – Thomas G Aug 23 '16 at 09:33
  • http://stackoverflow.com/questions/20194919/how-to-implement-custom-iterable-class-in-vba – Tim Williams Aug 23 '16 at 15:59

0 Answers0