?
Solved

for each... in ...  loop

Posted on 1998-12-17
2
Medium Priority
?
156 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
[X]
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
2 Comments
 
LVL 1

Author Comment

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

Accepted Solution

by:
ameba earned 200 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

770 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