Thank you so much for the web site references. I studied those and did the
lessons. I found some code that was perfect for my project with only a few
tweeks. I have a form that opens with a Template and displays a list of
states drawn from a table in another file. In the second column of each row
of the source table is one of four cities. All I need now is a way of having
another combo box display what is in column two when something from column
one is selected in ComboBox1. The reason I want a second combobox is that I
would also like Combobox2 populated from the second column of the table on
initialization so that if someone knows the city they can bypass the state
list, open combobox2 and select the city. Once the city is determined by
either method, a particular address is displayed in a label.
Private Sub UserForm_Initialize()
Dim myArray() As Variant
Dim sourcedoc As Document
Dim i As Integer
Dim j As Integer
Dim myitem As Range
Dim m As Long
Dim n As Long
Application.ScreenUpdating = False
'Modify the following line to point to your list member file and open the
document
Set sourcedoc = Documents.Open(FileName:="C:\Documents and
Settings\John\sourceWord.doc")
'Get the number of list members (i.e., table rows -1 if there is a hearder row
i = sourcedoc.Tables(1).Rows.Count - 1
'Get the number of columns in the table
j = sourcedoc.Tables(1).Columns.Count
'Set the number of columns in the list box
'ComboBox1.ColumnCount = j
'Load list members into an array
ReDim myArray(i, j)
For n = 0 To j - 1
For m = 0 To i - 1
Set myitem = sourcedoc.Tables(1).Cell(m + 2, n + 1).Range
myitem.End = myitem.End - 1
myArray(m, n) = myitem.Text
Next m
Next n
'Populate the ComboBox using the array
ComboBox1.List() = myArray
'Cloze th source file
sourcedoc.Close savechanges:=wdDoNotSaveChanges
End Sub
Is the next step a proceduce
Private Sub ComboBox1_AfterUpdate()