PDA

View Full Version : Solved: Code execution interrupted



herzberg
09-26-2007, 07:01 PM
Hi all!

I've encountered this extremely annoying problem last night. It's as if there was an invisible hand pressing Ctrl + Break all the time while my macro ran. For some weird reasons, the "Code execution has been interrupted" pop-up keeps appearing whenever I run my macros.

Initially, I thought it was due to errors within my code. However, I checked through the code and found nothing amiss. In fact, the macros ran along fine and achieved the desired output as long as I clicked on the "Continue" button in the pop-up.

I transferred the Excel file and ran the exact same macro on another computer and it worked fine, i.e. no irritating pop-ups. Thus, I guessed I must have messed up some settings within my copy of Excel on my computer. It'll be great if you guys can help me on this. Thanks!

TonyJollans
09-26-2007, 08:57 PM
It is extremely annoying, isn't it! I have been trying to find out about this for some time and I'm sorry to say I have no answers for you.

It seems as if some code or some activity triggers the situation but, once triggered it won't go away. I *think* that closing all office applications and reopening them clears it - certainly rebooting does. But, of course, whatever the trigger is, it can re-occur.

I have had it recently running Office 2007 under Vista - but once it has been triggered it can happen in app in any office version (I have 2002 and 2003 as well as 2007 on the one machine). I remember it once before on a different machine running, I think, Office 2003 under XP Pro - certainly pre-dating Vista. I think it tends to happen when Windows has been running for a few days but I am far from sure of that.

Any further information or observations you can provide would be very helpful. I remain as mystified and frustrated as you!!

herzberg
09-27-2007, 11:49 PM
Hi Tony,

Thanks for the reply. I did try closing all office applications and opening them again but it doesn't work. What did the trick for me was - as you suggested - a reboot. When my system boots up, the invisible hand has disappeared totally and my macros ran without those pop-ups appearing repeatedly.

Oh, by the way, the problem occured after I dropped my mouse accidentally on the floor. As I fumbled with the mouse cable, I pressed the mouse buttons a couple of times. That led to my earlier assumption that I could have messed up some settings through the random presses.

Besides those irritating pop-ups, I also noticed that the Properties windows in VBE was grayed out, as if it was disabled. However, I could still make changes, e.g. setting a command button's visibility to false or changing an option button's value to true, etc.

Anyway, now that the problem is gone, I do hope it doesn't come back again, either by chance or through my actions.

TonyJollans
09-28-2007, 03:19 AM
I can't say I've seen any symptoms like that - but I have a cordless mouse :)

If you ever do find out anything I would be very pleased to hear about it.

mdmackillop
08-21-2008, 04:58 AM
Hi Tony,
Re Code Interrupted I came across this (http://www.mrexcel.com/forum/showthread.php?p=1379824). Just tried it and it seems to work!
Regards
Malcolm


Application.EnableCancelKey = xlDisabled