Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

combobox change event is running when enable events is false

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tysop - 24 Jan 2006 12:06 GMT
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
Norman Jones - 24 Jan 2006 12:27 GMT
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

>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
[quoted text clipped - 11 lines]
>
> Many thanks
tysop - 24 Jan 2006 14:07 GMT
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

> Hi Tysop,
>
[quoted text clipped - 38 lines]
> >
> > Many thanks
Tom Ogilvy - 24 Jan 2006 14:16 GMT
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.

Signature

Regards,
Tom Ogilvy

> 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
[quoted text clipped - 46 lines]
> > >
> > > Many thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.