LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Nesting Collections

I keep coming across situations where it would be really useful to
create collections within collections, but I just can't quite work it
out. Here's the closest I've gotten: I have a class module called
Sample, with the following public variables (among others):
Name as string
SampleType as string
Elements as collection

in my main sub:

dim Sample as Sample
dim Samples as collection

set Samples = new collection

for each File in application.filesearch.foundfiles
set Sample = new sample
set Sample.Elements = new collection
Sample.Name = (somevalue)
for i = 1 to 10
Sample.Elements.add (somevalue, somekey & i)
next i
debug.print sample.elements(somekey) 'OK so far
samples.add Sample '(with Sample.Name as key)
Next File

For each Sample in Samples
debug.print Sample.Name 'Works
debug.print sample.elements.count 'Works
debug.print Sample.Elements(somekey1)
'Gives Error '424' Object Required
debug.print Sample.elements(1) 'gives error also
Next Sample

Anyone out there know the proper way to nest collections or an elegant
alternate? Thanks! -Lisa

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enumerations or Collections PaxtonRoadEnd Excel Programming 1 October 5th 07 05:51 PM
For Each and Collections Memento Excel Programming 6 June 4th 07 02:57 PM
Collections of Collections David Morton Excel Programming 6 November 13th 04 01:10 AM
Help with collections ksnapp[_45_] Excel Programming 1 April 7th 04 12:42 AM
Using Collections Kerry[_4_] Excel Programming 1 January 25th 04 04:08 PM


All times are GMT +1. The time now is 02:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"