Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

for each... in ...  loop

Posted on 1998-12-17
2
153 Views
Last Modified: 2010-05-03
i am using this code within a class (called BLUBs)
This class holds a collection with objects of type BLUB in it.

Public Property Get NewEnum() As IUnknown
    Set NewEnum = myCollection.[_NewEnum]
End Property

Now code like this should work (Object XX already initialized)
dim XX as BLUBs
dim X as BLUB

for each X in XX
   ...
I get a runtimeerror. Object does not support this property.
0
Comment
Question by:tstrob
2 Comments
 
LVL 1

Author Comment

by:tstrob
ID: 1451124
Edited text of question
0
 
LVL 15

Accepted Solution

by:
ameba earned 50 total points
ID: 1451125
Employees.cls, somewhere in your samples directory:
' NewEnum method enables the use of For
' -------       Each with the Employees
'   collection class.  For an
'   explanation, see "Creating Your Own
'   Collection Class: The House of Bricks"
'   in Books Online.
'
' For NewEnum to work properly, its
'   procedure ID must be set to -4.  To see
'   this, select Procedure Attributes
'   from the Tools menu.  In the Name box,
'   select Item, then click the Advanced
'   button.  You can see that the Procedure
'   ID has been set to -4.  ("Hide this
'   member" is checked, also, so that the
'   NewEnum method is hidden in the Object
'   Browser.)

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question