Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default ComboBox.Clear method calling ComboBox_Change event?

I need to clear out a ComboBox in order to prep it for later use. At the
current time, it has 200 entries. Eventually it will have over 2000. Removing
each item individually is not a desirable option. It takes a while to load
it. I'd hate for it to take that long to unload.

Problem is, when I execute ComboBox.Clear, it appears to call the
ComboBox_Change() event. Since there is nothing in the ComboBox, it calls the
error handler that checks for unknown entries (ie: typing your own data in
the BomboBox).

Is there a way to execute the .Clear method without calling the _Change()
event?
--
Adios,
Clay Harryman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default ComboBox.Clear method calling ComboBox_Change event?

If you don't want users to be able to type in values that are not in the
combo box list, you can set the combo box style to frmStyleDropDownList.

When you clear the combo box list and the combo box currently has a selected
value, the Change event will fire. To avoid executing your code in the
change event, maybe you can exit out of the sub if the combo box has no value
selected. For example:

Private Sub ComboBox1_Change()
If ComboBox1.ListIndex = -1 Then Exit Sub

'put your code below
End Sub


--
Hope that helps.

Vergel Adriano


"Clayman" wrote:

I need to clear out a ComboBox in order to prep it for later use. At the
current time, it has 200 entries. Eventually it will have over 2000. Removing
each item individually is not a desirable option. It takes a while to load
it. I'd hate for it to take that long to unload.

Problem is, when I execute ComboBox.Clear, it appears to call the
ComboBox_Change() event. Since there is nothing in the ComboBox, it calls the
error handler that checks for unknown entries (ie: typing your own data in
the BomboBox).

Is there a way to execute the .Clear method without calling the _Change()
event?
--
Adios,
Clay Harryman

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default ComboBox.Clear method calling ComboBox_Change event?

The code sample will work well.

I was afraid to try "frmStyleDropDownList", thinking it would force the
users to click and scroll through up to 2000 items. But it worked quite well!

Thank you!
--
Adios,
Clay Harryman


"Vergel Adriano" wrote:

If you don't want users to be able to type in values that are not in the
combo box list, you can set the combo box style to frmStyleDropDownList.

When you clear the combo box list and the combo box currently has a selected
value, the Change event will fire. To avoid executing your code in the
change event, maybe you can exit out of the sub if the combo box has no value
selected. For example:

Private Sub ComboBox1_Change()
If ComboBox1.ListIndex = -1 Then Exit Sub

'put your code below
End Sub


--
Hope that helps.

Vergel Adriano


"Clayman" wrote:

I need to clear out a ComboBox in order to prep it for later use. At the
current time, it has 200 entries. Eventually it will have over 2000. Removing
each item individually is not a desirable option. It takes a while to load
it. I'd hate for it to take that long to unload.

Problem is, when I execute ComboBox.Clear, it appears to call the
ComboBox_Change() event. Since there is nothing in the ComboBox, it calls the
error handler that checks for unknown entries (ie: typing your own data in
the BomboBox).

Is there a way to execute the .Clear method without calling the _Change()
event?
--
Adios,
Clay Harryman

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ComboBox_Change Event to Populate another Combox Tobi Excel Programming 4 October 31st 06 11:34 PM
Calling a sub method richcoleuk[_5_] Excel Programming 5 June 7th 06 10:33 AM
MsgBox in Enter event causes combobox not to run Change event Richard Excel Programming 0 March 6th 06 02:52 PM
Combobox_change event problem Shawn G.[_2_] Excel Programming 2 August 18th 05 01:37 PM
Combobox.clear Chris Houchin Excel Programming 5 May 27th 04 08:54 PM


All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"