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

ID: Q183384

The information in this article applies to:

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:

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, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

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.

Additional query words: combobox dropdown list box XL98

Keywords          : kberrmsg kbdta 
Version           : MACINTOSH:98
Platform          : MACINTOSH
Issue type        : kbbug
Solution Type     : kbpending

Last Reviewed: May 18, 1999