HELP!!! "Code execution has been interrupted"

x-amount

Active Member
Joined
May 16, 2003
Messages
260
But I havent pressed anything!!!

There is definite problem, as the "Code execution has been interrupted" error message appears seemingly at random (although if the workbook doesnt change it is the same points), and for no reason.

If I click the continue button the macro runs exactly as planned, but still there seems to be no rhyme or reason as to why this happens!?

It even invokes on the workboon_open function.

Any ideas???
 
Yup. This new computer has been fine with new and old code, and then suddenly I write code in Word and it flares up again. It's like excema. The break line is chosen at random, and it not the sort of line that could cause a problem.

Just thought I'd give an example:

The line I got an error on was "
Code:
Else
".

It's a loop, and that's the thousandth time in that iteration that it will have executed the code in the Else section, and suddenly it decides to stop there.
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Code execution has been interrupted

I began to experience this issue after using a wireless keyboard plugged into my laptop USB port. I am fairly certain a hardware compatability issue is sending a false break command because of this. - Something to think about.
 
Upvote 0
My solution

I finally found pattern to this, and I think it has solved it in my instance because I can switch the problem on and off! It is associated with Adobe Acrobat 5.0 and specifically the files pdfmaker.xla. This appears to be the problem, though I don't know why?

I removed pdfmaker.xla (and pdfmaker.ppa and pdfmaker.dot) and the problem disappeared. When I restored them, the problem came back. When I removed them again, the problem disappeared again. Coincidence? I don't think so!

I've now completely uninstalled Acrobat and purchased Neevia DocuPrint, which for what I need is a much better piece of software, and only cost $29 US for 2 licenses.
 
Upvote 0
code execution has been interrupted

I have a macro that updates a pivot table everytime a cell is updated.
Trouble is, often I get "code execution has been interrupted" right at the beginning (header line) of the macro.

Does anyone know why this happens?

Txs & cheers
 
Upvote 0
I had this same problem, which took me nearly 2 days to fix - since there is no help for this on the Internet. For me, my program automatically opened and closed when used. So I pressed ctrl-break to edit changes in Visual Basic, and this creates some sort of fatal error in the memory of Excel. What I did is change the program so ctrl-break did not have to be applied to edit the coding. Then I reset the computer to erase the memory in Excel - and it works.

Hope this helps.
 
Upvote 0
Post the Workbook_Open code.

I have the same issue, but I don't have any code in the Workbook_Open function.

Also when I try to get into atpvbaen.xla or funcres.xls in the VBE I get a password box.

Any help would be appreciated.
 
Upvote 0
just to add to the confusion


I have a worksheet that has been working fine for years -

three new PCs were delivered to the office. Of the 3 two of them work perfectly. The third gives the same error that everybody else is getting

"Code execution has been interrupted"


from my networked location it runs fine, from the other 2 pcs at that location it works fine


it happens as you open the file

using continue gets you through the problem

I even used a remote control to disable their keyboard and mouse and ran it through the controler pc

same result

so diffinately no one is hitting any kind of key - nor is it a keyboard problem
 
Upvote 0
I believe I have a solution for all on this one. :biggrin: Let me explain fully:

How to duplicate and cause the "Code execution has been interrupted" error: :confused:

1) Use Ctrl-Break to interrupt a macro--this corrupts things from now on :devilish:
2) Now, if you add or change any macro code or use break points...
3) Upon rerunning the macro, you may get the "Code execution has been interrupted message".
4) Choosing "Debug" leads you to seemingly random locations--where there is no real error. Continuing execution each time will eventually allow the macro to finish, despite the annoying Code interruption error. :devilish:

How to fix this error: :eek:

Simplest: Fully Reboot/Restart the computer :p (a logout/login will NOT work!)

Alternative: I've not foolproof it yet, but you can use Application.EnableCancelKey = wdCancelDisabled or = wdCancelInterrupt (Word macro) or = xlDisabled, = xlErrorHandler, or = xlInterrupt (Excel) :rolleyes: to change the effect of the Ctrl-Break key.

Note: After using Ctrl-Break, and making macro edits, you may save your macros without worry of corruption. After the reboot, you will find that your saved code will not fail due to the "Code execution has been interrupted" error. Avoid using Ctrl-Break, if possible, and you will have no further problems. :wink:
 
Upvote 0
Solution:

You probably do not declare variables,
you probably recently used Option Explicit :eek:
 
Upvote 0
Solution:

You probably do not declare variables,
you probably recently used Option Explicit :eek:
Nope, wrong error message. E.g.,

Code:
Option Explicit

Sub foo()
Let bar = "Hello World!"
End Sub
Error messages are important, read them closely. :wink:

There might be some junk and bloat in your file from manipulating it so much...

Try running the Excel file in question through a different platform, like Excel for the Mac (on a Mac) or Open Office, to rebuild the file's ExCodes. I.e., open and save the file on a different platform. Now retry the file, in Excel. :)
 
Upvote 0

Forum statistics

Threads
1,215,267
Messages
6,123,964
Members
449,137
Latest member
yeti1016

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