In Excel VBA, you can hit ctrl+break to interrupt your code execution. When you do so, you get a window with the options:
Continue, End, Debug, and Help.
This is useful when you WANT to jump into your code to debug, but I've noticed something odd. If I ctrl-break, then immediately click 'continue' or 'end', 9 times out of 10 (though usually 100% of the time) the code will enter a mode where it will randomly throw the "Code Execution has been interrupted" window as if I hit ctrl-break, even though I didn't.
Clicking Debug to see where it's stopped shows it halting at different lines everytime. Ending then restarting the code doesn't reset anything. Even restarting Excel won't fix it. It's like once that 'mode' gets activated, I'm stuck with it until I restart windows. (which so far is my only sure-fire solution)
I've found 2 workarounds:
1. if the 'mode' hasn't begun and I ctrl-break but then hit the F8 button several times(which advances the code execution by several lines), BEFORE clicking 'end' or 'continue', it doesn't seem to activate the 'weird' mode. (Conversely, if I ctrl-break and then immediately click on END or Continue, without advancing, it will start misbehaving)
2. If I put in the line:
Application.EnableCancelKey = xlDisabled
then this will shut off the Debug window Entirely, allowing the code to finish running without interruption, but it also has the side-effect of preventing ME the ability to ctrl-break, which isn't useful when I'm trying to debug.
I've done a lot of searching on this error over the past couple years (culminating in workaround 2 above), but there doesn't seem to be any useful help for this exact error. I'd love to know what is going on so I can stop it. Having to restart umpteen times a day or disabling code interruption is not making my life very efficient.
Most 'helpers' refuse to even help unless the user posts code, which in this particular error isn't helpful since there is no pattern. In addition, my coworkers aren't able to recreate the error on their computers unless I'm logged in. (indicating to me, it's a profile issue or even a template problem; see 1. below)
There are a few general tips I've found and tried to no avail.
1. VBA bloated templates But I'm not using any templates, unless it's the default one, but I always close "Book1" when I start Excel.
2. third-party add-in(s). I had a couple that were continually trying to load up, but I've disabled them and it doesn't seem to help
3. Export all code and re-import it. This didn't help at all.