cmbAnswer, cmbAnswer1 are all the names of the list boxes. Every time I try to run it, it gives me a Run time error '424' object required. What am I doing wrong? Also, how do I reference the combo box from a module or something outside the document. It is something like:
ActiveDocument.?.cmbAnswer?????? I thought that might be the problem, but couldn't figure out how to reference it. Thanks for the help, below is the code.
Sub FillComboBoxes()
'
' FillComboBoxes Macro
' Macro created 08/20/2001 by Steve Ryan
'
FillComboBox (cmbAnswer)
FillComboBox (cmbAnswer1)
FillComboBox (cmbAnswer2)
FillComboBox (cmbAnswer3)
FillComboBox (cmbAnswer4)
FillComboBox (cmbAnswer5)
FillComboBox (cmbAnswer6)
FillComboBox (cmbAnswer7)
FillComboBox (cmbAnswer8)
FillComboBox (cmbAnswer9)
End Sub
Sub FillComboBox(cmbName As ComboBox)
cmbName.AddItem "1"
cmbName.AddItem "2"
cmbName.AddItem "3"
cmbName.AddItem "4"
cmbName.AddItem "5"
cmbName.AddItem "6"
cmbName.AddItem "7"
End Sub
ActiveDocument.?.cmbAnswer?????? I thought that might be the problem, but couldn't figure out how to reference it. Thanks for the help, below is the code.
Sub FillComboBoxes()
'
' FillComboBoxes Macro
' Macro created 08/20/2001 by Steve Ryan
'
FillComboBox (cmbAnswer)
FillComboBox (cmbAnswer1)
FillComboBox (cmbAnswer2)
FillComboBox (cmbAnswer3)
FillComboBox (cmbAnswer4)
FillComboBox (cmbAnswer5)
FillComboBox (cmbAnswer6)
FillComboBox (cmbAnswer7)
FillComboBox (cmbAnswer8)
FillComboBox (cmbAnswer9)
End Sub
Sub FillComboBox(cmbName As ComboBox)
cmbName.AddItem "1"
cmbName.AddItem "2"
cmbName.AddItem "3"
cmbName.AddItem "4"
cmbName.AddItem "5"
cmbName.AddItem "6"
cmbName.AddItem "7"
End Sub