I am trying to add a listbox Activex control to a word form. The help text
says to set the "Displayvalues" property but when I open the properties for
the control, Displayvalues is not a listed property.
You were looking at the help for a dropdown control for a Web page.
The ActiveX control from the Control Toolbox is not at all the same
beast, so that help topic doesn't apply.
ActiveX controls can't store their values; you have to reload them
each time the user creates a new document or opens an old one. To do
that you need VBA code in the Document_New and Document_Open
procedures.
One way is to repeat the .AddItem method once for each entry you want
to add:
Private Sub Document_New()
With ComboBox1
.AddItem "one"
.AddItem "two"
.AddItem "three"
.ListIndex = 0
End With
End Sub
This gets pretty tedious after three or four items. Another way is to
load all the items into an array in a Variant variable, and then
assign the variable to the box's .List property:
Private Sub Document_New1()
Dim TheList As Variant
TheList = Array("one", "two", "three")
ComboBox1.List = TheList
ComboBox1.ListIndex = 0
End Sub
A variation of the .List method is to load the array from an external
data source, which can be a Word document, an Excel worksheet, a
database, etc. Sample code is shown near the end of
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnword2k2/html/odc_activeX.asp.