Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Filling 2 column list box with Collection?

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)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Filling 2 column list box with Collection?

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


"What-a-Tool" wrote in message
news:M4W%c.17411$aW5.14719@fed1read07...
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)




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Filling 2 column list box with Collection?

Thank you very much - was just the ~ .list(.listcount - 1, 1) = "filename"
~
That I wasn't seeing. Works great.

--

/ Sean the Mc /


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

"Tom Ogilvy" wrote in message
...
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


"What-a-Tool" wrote in message
news:M4W%c.17411$aW5.14719@fed1read07...
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)






Reply
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
filling list HAK Excel Discussion (Misc queries) 2 January 16th 08 10:10 AM
how to change column references, while filling down another column bclancy12 Excel Discussion (Misc queries) 1 June 7th 06 04:13 PM
Filling in a form from a list sweetsue516 Excel Discussion (Misc queries) 0 March 29th 06 06:50 PM
Filling An Autofiltered List Neil Excel Programming 1 August 3rd 04 01:46 AM
filling a two column listbox from a two column recordset Dennis Excel Programming 5 May 23rd 04 10:13 PM


All times are GMT +1. The time now is 01:14 AM.

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

About Us

"It's about Microsoft Excel"