vbaprogammer
Programmer
First, this problem is in WORD VBA -- I have a combobox which is driven by the value in a textbox.<br><br>Based on the value in a textbox, the original combobox list should be replaced with new list items. Instead, the new items are being added to the existing list.<br><br>I believe that the values would be updated IF the form were to be initialized, but that can't be done without losing other values in the dialog.<br><br>I have written a little code in a form which demonstrates this problem. The command button represents the textbox value change.<br>============<br>Option Explicit<br>Dim MyList() As String<br>Dim x As Integer<br><br>Private Sub CommandButton1_Click()<br> ReDim MyList(2)<br> MyList(0) = "NewTest1"<br> MyList(1) = "NewTest2"<br> MyList(2) = "NewTest3"<br>For x = 0 To 2<br> Me.ComboBox1.AddItem MyList(x)<br>Next<br>End Sub<br><br>Private Sub UserForm_Initialize()<br> Dim MyList(2)<br> MyList(0) = "Test1"<br> MyList(1) = "Test2"<br> MyList(2) = "Test3"<br>For x = 0 To 2<br> Me.ComboBox1.AddItem MyList(x)<br>Next<br>End Sub<br><br>Can anyone help me refresh/update the combox list to new information, getting rid of old list items somehow?<br><br>(Perhaps some of you are knowledgeable in both Word and Access VBA ... as I discover I must be. I can't find a forum as good as this one on Word VBA ... anybody know of one?)<br><br>Thanks,<br>Dan