Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Application.EnableEvents = False not working

Hi all

I am trying to stop events as follows:

Application.EnableEvents = False
cboIssues.ListIndex = 1
Application.EnableEvents = True

The idea is that I don't want the Worksheet_Change() event to fire when
I set the ComboBox index. But as soon as I run the 2nd line, it goes
straight to the event. What am I not doing? I looked up help which
suggested I need an EventClassModule to instantiate the Application,
which I have done, but to no avail.

Any help appreciated.

Paul Martin
Melbourne, Australia

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Application.EnableEvents = False not working

Hi Paul,
The Application.Enable events setting controls only Workbook and Worksheet
events. If you need to stop the code from executing in certain circumstances,
use a global variable. Set its value such as
gbExternal = true
<do things like setting the list index of the listbox/combobox etc
gbExternal = false

and then in the actual event handler write
if gbExternal then exit sub


"Paul Martin" wrote:

Hi all

I am trying to stop events as follows:

Application.EnableEvents = False
cboIssues.ListIndex = 1
Application.EnableEvents = True

The idea is that I don't want the Worksheet_Change() event to fire when
I set the ComboBox index. But as soon as I run the 2nd line, it goes
straight to the event. What am I not doing? I looked up help which
suggested I need an EventClassModule to instantiate the Application,
which I have done, but to no avail.

Any help appreciated.

Paul Martin
Melbourne, Australia


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Application.EnableEvents = False not working

Hi Alok

Great, thanks.

Regards

Paul

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Application.EnableEvents = False not working

In your Worksheet_Change() event, add the following If statement:

Sub Worksheet_Change()
if cboIssues.ListIndex = 1 then
' your existing code here
end if
end Sub

This will trigger the event only when the index is 1. Or put <1 if you need
the oposit thing to happen.

- Mangesh



"Paul Martin" wrote in message
oups.com...
Hi all

I am trying to stop events as follows:

Application.EnableEvents = False
cboIssues.ListIndex = 1
Application.EnableEvents = True

The idea is that I don't want the Worksheet_Change() event to fire when
I set the ComboBox index. But as soon as I run the 2nd line, it goes
straight to the event. What am I not doing? I looked up help which
suggested I need an EventClassModule to instantiate the Application,
which I have done, but to no avail.

Any help appreciated.

Paul Martin
Melbourne, Australia



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
Application.EnableEvents DCPan Excel Worksheet Functions 3 October 18th 08 05:46 AM
application.EnableEvents nc Excel Discussion (Misc queries) 1 September 28th 05 04:00 PM
Problems with BeforeSave and Application.EnableEvents = False Sanne Excel Programming 3 February 11th 05 12:26 PM
object.EnableEvents = false Ajit Excel Programming 1 November 3rd 04 09:54 PM
Application.EnableEvents Terry Excel Programming 2 April 2nd 04 08:25 PM


All times are GMT +1. The time now is 06:07 PM.

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"