+ Reply to Thread
Results 1 to 2 of 2

Prevention of entering Break Mode in VBA

  1. #1
    Registered User
    Join Date
    01-12-2022
    Location
    Leuven,Belgium
    MS-Off Ver
    2013
    Posts
    1

    Prevention of entering Break Mode in VBA

    Hi,

    I am trying to figure out how to prevent pausing/interrupting the VBA code on my worksheets.
    Adding a password to the VBA code still allows everyone to enter Break Mode and bypass all codes on the worksheets.
    I have tried using:

    Application.EnableCancelKey = xlDisabled

    And have tried immediately shutting down the interrupt key by using:

    If Application.EnableCancelKey = xlInterrupt Then
    Application.EnableCancelKey = xlDisabled
    End If

    My knowledge of VBA is pretty basic so help would be very much appreciated!

    Kr, Simon

  2. #2
    Forum Contributor GWteB's Avatar
    Join Date
    12-13-2021
    Location
    GMT +1
    MS-Off Ver
    2013
    Posts
    136

    Re: Prevention of entering Break Mode in VBA

    Hi & welcome to ExcelForum!

    The EnableCancelKey property is always reset to xlInterrupt whenever Microsoft Excel returns to the idle state and there's no code running. To trap or disable cancellation in your procedure, you must explicitly change the EnableCancelKey property every time the procedure is called. It's recommended to use this property very carefully. If you use xlDisabled, there's no way to interrupt an infinite loop or any non – self-terminating code. Also, if you use xlErrorHandler but your error handler always returns using the Resume statement, there's no way to stop your code.

+ 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. Stuck in Break Mode
    By BrianAll in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-01-2019, 08:30 AM
  2. Detect Break-Mode
    By onidarbe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2016, 01:43 PM
  3. Any way to run a macro from VBE while in break mode
    By foxguy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-11-2013, 05:51 PM
  4. Break Mode
    By bstubbs in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2011, 03:22 AM
  5. Can I use VBA to check if the sheet(xxx) is in Page-Break mode or Normal mode ?
    By BaLLZaCH in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2008, 09:03 AM
  6. Help with Break Mode
    By Lost and Looking for Help in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-01-2006, 03:25 PM
  7. [SOLVED] Can't enter break mode
    By eugene in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-11-2006, 04:25 PM

Tags for this Thread

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