N
Novice
Using the "record macro" feature I'm easily able to find that I can create an ActiveX ListBox in my Word Document by
Selection.InlineShapes.AddOLEControl ClassType:="Forms.ListBox.1
But I've been searching high and low (using google) to try to find some way of declaring a variable/object of type ListBox. Most of the VBA examples I found applied to Excel things like
Dim oleObj As OLEObjec
Dim oleObj As ListBo
Dim oleObj As MSForms.ListBo
Dim oleObj As Forms.ListBo
Dim oleObj As Word.OLEForma
All of the above throw run-time errors indicating that the type doesn't exist
However, on my own - using the code completion feature of Microsoft Visual Basic IDE I found this
Dim oleObj As Word.WdOLETyp
This actually doesn't throw an error when I
oleObj = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.ListBox.1"
However, it does throw run-time error when it gets to here
oleObj.MultiSelect = fmMultiSelectMult
At this point I would be satisfied with some extra parameter to this call (if such a parameter exists)
Selection.InlineShapes.AddOLEControl ClassType:="Forms.ListBox.1
such that the control is multi-select - as it doesn't seem possible to create a variable of the OLE type
I should add that I'm using Word 2000
Thanks
Novice
Selection.InlineShapes.AddOLEControl ClassType:="Forms.ListBox.1
But I've been searching high and low (using google) to try to find some way of declaring a variable/object of type ListBox. Most of the VBA examples I found applied to Excel things like
Dim oleObj As OLEObjec
Dim oleObj As ListBo
Dim oleObj As MSForms.ListBo
Dim oleObj As Forms.ListBo
Dim oleObj As Word.OLEForma
All of the above throw run-time errors indicating that the type doesn't exist
However, on my own - using the code completion feature of Microsoft Visual Basic IDE I found this
Dim oleObj As Word.WdOLETyp
This actually doesn't throw an error when I
oleObj = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.ListBox.1"
However, it does throw run-time error when it gets to here
oleObj.MultiSelect = fmMultiSelectMult
At this point I would be satisfied with some extra parameter to this call (if such a parameter exists)
Selection.InlineShapes.AddOLEControl ClassType:="Forms.ListBox.1
such that the control is multi-select - as it doesn't seem possible to create a variable of the OLE type
I should add that I'm using Word 2000
Thanks
Novice