Microsoft KB Archive/168604
Article ID: 168604
Article Last Modified on 10/11/2006
- Microsoft Excel 97 Standard Edition
This article was previously published under Q168604
When you click a combo box in a UserForm in Microsoft Excel 97, you may receive the following error message:
Or, you may receive the following error message:
If you click Details, you receive an error message similar to either of the following:
This problem may occur if the following conditions are true:
- A Visual Basic subroutine is assigned to the DropButtonClick event of the combo box. -and-
- The DropButtonClick subroutine uses the List property to reset the list assigned to the combo box.
See the "More Information" section of this article for an example that causes this problem to occur.
To prevent this problem from occurring, do not change the List property for a combo box in the subroutine assigned to the DropButtonClick event of the combo box.
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
When you add a control to a UserForm in Microsoft Excel 97, you can assign a subroutine to each event to which the control responds: for example, Click, Change, DblClick, and so on. To do this, follow these steps:
- In the UserForm, double-click the control.
- In the Procedure list box, select the event to which you want to assign a subroutine.
The code window will display a subroutine for the specified event and control. For example:
Private Sub ComboBox1_DropButtonClick() '<code goes here> End Sub
The DropButtonClick event for a combo box is triggered whenever the list for the combo box appears or disappears. If the subroutine assigned to this event uses the List property to reset the list for the combo box, you will receive an error message when you run the UserForm and click the combo box. For example:
Private Sub ComboBox1_DropButtonClick() Dim ListArray(0 To 3) As String ListArray(0) = Now ListArray(1) = Now + 0.25 ListArray(2) = Now + 0.5 ListArray(3) = Now + 1 ComboBox1.List = ListArray End Sub
It is recommended that you do not use this method to reset the list for a combo box in Microsoft Excel 97. Instead, reset the list when you display the UserForm, or when you click another control in the UserForm, such as a command button.
Additional query words: 97 XL97 combobox dropdown list box
Keywords: kberrmsg kbhowto kbprb kbui KB168604