N
Novice
Hi all, I'm in the process of creating a word document that contains a 10 column by 200 row table. I've inserted a listbox in one cell and then another in the cell adjacent to it (on the same row). I've written some code that will remember the selections in the boxes. In addition, the second list box will be populated with information specific to the selection the user made in the first list box. This all works and for illustration purposes - here is an example of how it could work
------------------
|cat |
|dog |
|bird |
------------------
When the user selects "cat", the listbox in the adjacent cell is populated with data specific to "cat" - for example
------------------
|cat |lion
|dog |cheetah
|bird |
------------------
The listboxes also support multi-select - and the data is simply added to the listbox in the adjacent cell - for example if the dog item was also selected
------------------
|cat |lion
|dog |cheetah
|bird |wolf
------------------
Anyway, the above all works fine - but I have created several procedures (Sub's) to achieve all of this - though the procedures are small, I don't want to have to repeat them 200 times for each row
But currently I don't know of anyway to iterate over all the listboxes in a document - I was hoping I could do something like
Dim aDoc As Word.Documen
Dim curListBox As ListBo
Set aDoc = ActiveDocumen
For Each curListBox In aDoc.ListBoxe
'Insert code her
Nex
But there is no such method or property
Does anyone know how to get all of the ListBoxes in the current document - so that someone could iterate over them
I'm guessing that I'm going to have to get some other set of objects like "FormItems" or something - but since I have no other "active content" in my word document that is also fine
Thanks
Novice
------------------
|cat |
|dog |
|bird |
------------------
When the user selects "cat", the listbox in the adjacent cell is populated with data specific to "cat" - for example
------------------
|cat |lion
|dog |cheetah
|bird |
------------------
The listboxes also support multi-select - and the data is simply added to the listbox in the adjacent cell - for example if the dog item was also selected
------------------
|cat |lion
|dog |cheetah
|bird |wolf
------------------
Anyway, the above all works fine - but I have created several procedures (Sub's) to achieve all of this - though the procedures are small, I don't want to have to repeat them 200 times for each row
But currently I don't know of anyway to iterate over all the listboxes in a document - I was hoping I could do something like
Dim aDoc As Word.Documen
Dim curListBox As ListBo
Set aDoc = ActiveDocumen
For Each curListBox In aDoc.ListBoxe
'Insert code her
Nex
But there is no such method or property
Does anyone know how to get all of the ListBoxes in the current document - so that someone could iterate over them
I'm guessing that I'm going to have to get some other set of objects like "FormItems" or something - but since I have no other "active content" in my word document that is also fine
Thanks
Novice