Classes, and the For Each construct in Excel?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
As a VB6 programmer doing a bit of VBA work, I want to use classes, and have a global collection for some specific data, so that I can do a 'For Each' construct to loop through the collection object
All I seem to get is Error 438 - Object doesn't support this property or method

Is there a better way of doing this in Excel?

The basic code I have is..

A class cProject
A collection class cProjects

dim oProj as cProject
set Projects = new cProjects
Projects.add .... 'add an instrance - this is successful

for each oProj in Projects
...
next

Any help would be appreciated
Many thanks!
 
Andy

VBA doesn't support directly. However, you can modify the class module in a
text editor and import it back into VBA. See this post by Chip Pearson.

http://www.google.com/groups?threadm=eEGfOYbgAHA.1308@tkmsftngp02

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

Andy said:
Hi,
As a VB6 programmer doing a bit of VBA work, I want to use classes, and
have a global collection for some specific data, so that I can do a 'For
Each' construct to loop through the collection object
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top