Loads up a Listbox and a Combobox
Sub LoadEmUp()
Dim whatever1()
Dim whatever2()
Dim var, var2
whatever1 = Array("LIST_item1", "LIST_item2", "LIST_item3")
whatever2 = Array("COMBO_item1", "COMBO_item2", _
"COMBO_item3", "COMBO_item4", "COMBO_item5")
ListBox1.Clear
ComboBox1.Clear
For var = 0 To UBound(whatever1)
ListBox1.AddItem whatever1(var)
Next
For var2 = 0 To UBound(whatever2)
ComboBox1.AddItem whatever2(var2)
Next
ComboBox1.ListIndex = 0
End Sub
Gets the lists
Sub GetEm()
Dim msg As String
Dim myObject As Object
Dim objInline As InlineShape
Dim var, var2
If ActiveDocument.InlineShapes.Count > 0 Then
For var = 1 To ActiveDocument.InlineShapes.Count
Set objInline = ActiveDocument.InlineShapes.Item(var)
If objInline.Type = 5 Then
For var2 = 0 To objInline.OLEFormat.Object.ListCount - 1
MsgBox objInline.OLEFormat.Object.List(var2)
Next
End If
Next
End If
End Sub
The reason the code checks for Type, is in case there is an InlineShape that
is NOT a wdInlineShapeOLEControlObject (type = 5)
You may need to go deeper with this if you have control objects that are not
either listbox or combobox.
You could use a TypeOf check.
However, I question why you are doing this as you have to populate the list
anyway, to get the list in there. So....you should have the list already.
or are you asking really for something else?
Post by AmbigaHi,
I want to know how to retrieve the list items of List Box and combo Box
controls available in Inlineshapes.
Thanks in advance.
-----
Ambiga
--
Message posted via http://www.officekb.com