Populating multi-column listbox from collection?

  • Thread starter Thread starter What-a-Tool
  • Start date Start date
W

What-a-Tool

Have a collection containing folders and files that I want to put into a 2
column list box using a For Loop.
I have done this in Access vba and .Net apps, but I'm going crazy trying to
get this to work in excel vba.
Can any one show or point me to a code sample demonstrating this, Please?

Found lots of samples of setting the list() property to an array, but
nothing on doing it row by row with a loop.

Thanks in advance for any help

--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
Was given the answer on excel. programming (Yeah - I know - please don't
double post!)
If anyone cares , here is the solution:
--------------------------------------------------------

For Each Item In MyCollection
With UserForm1.ListBox1
.AddItem Item
.list(.listcount - 1, 1) = "filename"
End With
Next Item

You said a collection, but not sure where the pathes and the filenames are
located unless you are parsing them out of the collection or you have arrays
in the collection. In any event, how you address the listbox is
illustrated - you should be able to adapt it to your data source.

--
Regards,
Tom Ogilvy




--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
 
Back
Top