+ Reply to Thread
Results 1 to 4 of 4

Is it possible Enable one/few events, and disable rest of the events by VBA Excel?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-18-2016
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    6

    Is it possible Enable one/few events, and disable rest of the events by VBA Excel?

    I want to use Right Click to show a "form", then using "toggle button" to control Enable & Disable Events.

    But the problem is when I toggle the button to disable event and close the window, It will also disable the right click event.

    Is there any way to solve this problem?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,703

    Re: Is it possible Enable one/few events, and disable rest of the events by VBA Excel?

    Excel VBA does not have enable/disable at the event level. Is this for other users, or just for your own convenience? I have a macro in PERSONAL.XLSB to enable and disable events and I put buttons for it in the Ribbon--no form required (see below).

    Otherwise, if you really need to do this with a right-click, you are going to have to write a handler for every event you want to prevent, and cancel the event. This will be workbook-specific. I am guessing that is not what you want.

    hoalahpi=toggle on Developer tab.jpg
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,703

    Re: Is it possible Enable one/few events, and disable rest of the events by VBA Excel?

    Here is the code behind those two buttons:
    Public Sub ToggleEvents()
       Application.EnableEvents = Not Application.EnableEvents
       QueryEvents
    End Sub
    
    Public Sub QueryEvents()
       MsgBox "Enable Events is now " & IIf(Application.EnableEvents, "ON", "OFF")
    End Sub

  4. #4
    Registered User
    Join Date
    06-18-2016
    Location
    Sydney
    MS-Off Ver
    2013
    Posts
    6

    Re: Is it possible Enable one/few events, and disable rest of the events by VBA Excel?

    Thank you, this way is good enough for me to Toggle them

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Enable events on the worksheet's code page
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-17-2016, 04:50 PM
  2. [SOLVED] Application Enable Events question
    By kstrick99999 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-08-2012, 04:47 PM
  3. [SOLVED] How to disable all Excel Events and then re-activate them?
    By Ben in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2006, 09:50 AM
  4. [SOLVED] Events won't Disable!
    By roadkill in forum Excel General
    Replies: 3
    Last Post: 04-26-2006, 02:30 PM
  5. combobox change event is running when enable events is false
    By tysop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-24-2006, 10:20 AM
  6. [SOLVED] Disable events
    By Nigel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2006, 02:45 AM
  7. [SOLVED] disable events does not work
    By Mika in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-15-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1