XL97: Error When You Change List Property of Combo Box (168604)



The information in this article applies to:

  • Microsoft Excel 97 for Windows

This article was previously published under Q168604

SYMPTOMS

When you click a combo box in a UserForm in Microsoft Excel 97, you may receive the following error message:
Run-time error '28':
Out of stack space
Or, you may receive the following error message:
This program has performed an illegal operation and will be shut down.
If the problem persists, contact the program vendor.
If you click Details, you receive an error message similar to either of the following:
EXCEL caused an invalid page fault in module FM20.DLL at 0137:60025b9e.
EXCEL caused an invalid page fault in module KERNEL32.DLL at 0137:bff85808.

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 assigned to the combo box.
See the "More Information" section of this article for an example that causes this problem to occur.

RESOLUTION

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.

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 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:

  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.
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.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kberrmsg kbhowto kbprb kbui KB168604