XL98: Error Appears When You Change List Property of Combo Box (183384)



The information in this article applies to:

  • Microsoft Excel 98 Macintosh Edition

This article was previously published under Q183384

SYMPTOMS

When you click a combo box in a UserForm in Microsoft Excel 98, you may receive one of the following error messages:
Run-time error '28':
Out of stack space

-or-

The application "Microsoft Excel" has unexpectedly quit, because an error of type 2 occurred.

You should save your work in other open applications and restart the computer.

-or-

Microsoft Excel quits.

CAUSE

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 that is assigned to the combo box.
For an example that causes this problem to occur, see the "More Information" section in this article.

WORKAROUND

To work around this problem, do not change the List property for a combo box in the subroutine that is assigned to the DropButtonClick event of the combo box.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

When you add a control to a UserForm in Microsoft Excel 98, 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:

  1. In the UserForm, double-click the control.
  2. In the Procedure list box, select the event to which you want to assign a subroutine.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. The code window then displays 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 that is assigned to this event uses the List property to reset the list for the combo box, you 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
				
Microsoft recommends that you do not use this method to reset the list for a combo box in Microsoft Excel 98. Instead, reset the list when you display the UserForm or when you click another control in the UserForm, such as a command button.

Modification Type:MajorLast Reviewed:6/17/2005
Keywords:kbbug kberrmsg kbpending KB183384