ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Classes, and the For Each construct in Excel? (https://www.excelbanter.com/excel-programming/305796-classes-each-construct-excel.html)

Andy

Classes, and the For Each construct in Excel?
 
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!

Dick Kusleika[_3_]

Classes, and the For Each construct in Excel?
 
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...%40tkmsftngp02

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

"Andy" wrote in message
...
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!





All times are GMT +1. The time now is 12:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com