"code execution has been interrupted " message

cray

New Member
Joined
Aug 24, 2007
Messages
2
Macros that used to work under Excel 2000 are under Excel 2002 SP3 (Windows XP Pro) producing the above message at random in different macros and or workbooks. It is as though I have pressed Cntr Break and I have not and no break points etc have been set. If I click on continue the macro continues to operate and again the message can appear apparently at random. I think it could be associated with memory as excel reports 85% of memory used. (3GHZ processor 1G ram) any help appreciated !


Thanks
Cliff
 
Ok folks. Give these solutions a shot. I encountered "Code Execution has been interrupted" a while back & I forgot how I solved it, until it recently happened again. Now I remember.

Even though macros/VBA procedures are text, Excel does have to manage them, because it has to remember where to find them when they are invoked. So moving macros around (as I did this time) does require Excel to do some housekeeping, that it might not like doing, or the indexes that you don't see, need some refreshing/organizing.

I recently moved a VBA procedure that called another, and then I started getting the error again. That's the key, that one macro was calling another, and the link between the 2 was disturbed, & Excel got confused.

I did copy the following command into VBE
Application.EnableCancelKey = xlDisabled and it did work, but I was not too keen with the idea of copying that command all over the place.

Rule#1. Save your file, backup/copy your file under another name to keep the original!!! Do it in Windows Explorer !! DO NOT "Save As" in Excel.

Solution1: Yes, remove all VBA modules out of your file. Save them in a folder to retrieve later. Close your Excel file. Close Excel, reboot your PC.
Open your file, Import all your modules back into your file, and your macros will likely work again.

Solution2: Remove 2-3 modules that are linked, or 1 macro is calling another. I did this. Removed them, saved them, closed Excel, rebooted my PC, opened Excel, imported the modules back into Excel and it worked! For me. Hope this works for you !!
 
Last edited:
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
This absolutely needs to be stickied. Solution1 fixed my problem. I tried "Application.EnableCancelKey = xlDisabled" and it did not work, but perhaps it was in the wrong location. Unrealistic to have to add this to every macro, anyway.

Buggy piece of crap! I can't believe a problem like this exists that can strike at any time if you are using several macros. I service a team of users that rely on macros to accomplish everyday tasks. If this came up when I leave - they would be clueless.

VBA is disgustingly outdated and needs to be revised. Microsoft has too many defenders that nurse these issues, including intelligent people who have been using their apps for years, because this is the only thing they have ever known. Tired of seeing answers on the forums, "well why do you want to do something this way?" Most of the time the answer should be, because it is logical and easier. We should not have to fix every macro we have every created, because of some buggy code that causes it to be crosslinked. Functions should not simply stop working in Access, because you use a database on another computer and some of the required .dll's are now "missing." Some of these problems have been around forever and need to be fixed.
 
Upvote 0
This morning was the first time ever that I came across this message in my 15 years working with Excel!

The version issue is funny however since I created the original file in Excel 2007 and it was working perfectly on my machine but when I installed it on my clients PC this was the issue.

The Application.EnableCancelKey = xlDisabled on top of each macro fixed my problem.

?

Regards
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top