PDA

View Full Version : Hierarchy



jrajul
03-27-2011, 09:16 PM
I have a Word document into which I added some activeX controls such as listboxes and command buttons.


In VBA, I would like to do work with these as variables.

Something like,

Dim LB as listbox
for each LB in activedocument
LB.add DATE
next LB

The issue is that I cannot find the hierarchy to do this. The activeDocument object does not seem to have a collection that holds the ActiveX controls.




Yes, I realize that I could do something like:
listbox1.add DATE
listbox2.add DATE
listbox3.add DATE
listbox4.add DATE
listbox5.add DATE
etc.


But that gets ever more cumbersome as my form gets bigger and more complex.

Does Word VBA have something like a collection where I can drill down and find all of the ActiveX listboxes in the document?

Note: the "inlineShapes" collection does not provide the activeX methods like .add, .clear, etc. The contentControls collection is for a different kind of listbox.