Microsoft KB Archive/182698

= XL98: System Error Using DropDown Method with ComboBox =

Article ID: 182698

Article Last Modified on 6/17/2005

-

APPLIES TO


 * Microsoft Excel 98 for Macintosh

-



This article was previously published under Q182698



SYMPTOMS
When you use the DropDown method in a Visual Basic for Applications procedure to display the list of a ComboBox, you may receive one of the following error messages

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

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

-or-

Sorry, a system error occurred.

"Microsoft Excel"

error type 11

and then Microsoft Excel quits.



CAUSE
This problem occurs when the following conditions are true:
 * You have a Visual Basic procedure attached to the Click event or the Change event of a ComboBox control in a UserForm. -and-


 * The Visual Basic procedure attempts to set the focus to, and then display the list of, another ComboBox control on the UserForm.



WORKAROUND
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 following example illustrates how to display the list of one ComboBox control when you make a choice in the list of another ComboBox control on a UserForm:  Close and save any open workbooks. Then, open a new workbook.  On Sheet1, enter the following values:        A1: Planes        C1: Alpha A2: Trains       C2: Bravo A3: Automobiles  C3: Charlie  Start the Visual Basic Editor, (press OPTION+F11). On the Insert menu, click Module.  In the Code window for the module, type the following procedure: Sub DropDown_ComboBox UserForm1.ComboBox2.DropDown End Sub  On the Insert menu, click UserForm.</li> Draw two ComboBox controls on the UserForm.</li> Double-click the UserForm to open the Code window for the UserForm.</li>  In the module, type the following code: Private Sub UserForm_Initialize

' Populate ComboBox1. ComboBox1.List = Worksheets("Sheet1").Range("A1:A3").Value

' Populate ComboBox2. ComboBox2.List = Worksheets("Sheet1").Range("C1:C3").Value End Sub

Private Sub ComboBox1_Click Application.OnTime Now, "DropDown_ComboBox" End Sub </li> Run the UserForm.</li></ol>

When you click an item in the list of ComboBox1, the list for ComboBox2 is automatically displayed.

<div class="status_section">

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

<div class="moreinformation_section">

MORE INFORMATION
<div class="references_section">