Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default combobox change event is running when enable events is false

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default combobox change event is running when enable events is false

I actually had just tried that and it works, but it's just annoying that I
now have to change a boolean and dissable events- I'll probably create a sub
that disables both and call that when i need to.

Many thanks

Tysop

"Norman Jones" wrote:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default combobox change event is running when enable events is false

Just for clarification, enableevents is part of the Excel Object model.
MSForms controls are part of the MSForms object model. These controls are
not affected by the EnableEvents setting.

--
Regards,
Tom Ogilvy

"tysop" wrote in message
...
I actually had just tried that and it works, but it's just annoying that I
now have to change a boolean and dissable events- I'll probably create a

sub
that disables both and call that when i need to.

Many thanks

Tysop

"Norman Jones" wrote:

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






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 on change event Matt Jensen Excel Programming 4 December 29th 04 04:37 PM
A procedure should run when one cell switch between false/true - but not with worksheet_calculate or change event... Gunnar Johansson Excel Programming 3 October 19th 04 05:24 PM
worksheet change event error events disabled Peter[_21_] Excel Programming 2 July 10th 04 08:45 AM
Enable/Disable Worksheet Change Event code Stuart[_5_] Excel Programming 2 November 3rd 03 07:22 PM
combobox change event scrabtree23[_2_] Excel Programming 3 October 20th 03 05:56 PM


All times are GMT +1. The time now is 08:03 AM.

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

About Us

"It's about Microsoft Excel"