View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default combobox change event is running when enable events is false

Hi Tysop,

Try using a public boolean variable selectively to disable the ComboBox
code.

At the top of a standard module:

Option Explicit

Public blDisable As Boolean

Then, in the sheet module:

'=============
Private Sub ComboBox1_Change()
If blDisable Then Exit Sub
'Your code
End Sub
'<<=============

When you need to disable the ComboBox1_Change code, assign a value of True
to the variable.


---
Regards,
Norman


"tysop" wrote in message
...
I am writing some VBA that changes the value in a control toolbox combobox,
but I don't want it to run the code assigned to changing the combobox ( it
clears it runs some other code and then changes it to a different value).
I
therefore disabled enableevents, but it is still doing so. I have even
put a
messagebox at the start of the combobox change event code to display the
enableevents status, and getting False back!

Is there anyway to avoid this, as surely the purpose of being able to
disable events is that this shouldn't happen.


I am using excel 2000 if that makes any difference.

Many thanks