[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Why do I get a message stating "Code execution has been interrupted" and how do I fix it?

Posted on 2011-11-01
8
Medium Priority
?
305 Views
Last Modified: 2012-05-12
Hello,

I have an excel file with a block of VB code attached to it and whenever I try to run it I get a message stating "code execution has been interrupted". When I hit the continue button then the code carrys on until the next seemingly arbitrary point at which the code stops and the message appears again. Could someone let me know why this is happening and how I can ensure the code runs continously?

Thanks,

f19l
0
Comment
Question by:f19l
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 37061842
Try turning off macro security
0
 

Author Comment

by:f19l
ID: 37061868
Macro security is currently set to low. Other files with embedded macros run fine.
0
 
LVL 3

Expert Comment

by:owitte
ID: 37062671
check the vba code for errors by running it step by step from the code editor. Usually this happens if there're unhandled errors.

Regards
Oliver
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:f19l
ID: 37062808
I have tried that but the strange thing is that when the code stops and I continue running it step-by-step, it works fine.
0
 
LVL 3

Expert Comment

by:owitte
ID: 37064242
can you post the piece of code where it stops (+/- about 10 lines) and give some info about the context?
0
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 2000 total points
ID: 37070427
Based on a quick Google search on "Code execution has been interrupted", it looks like this is an issue that has been around for a while.  The 1st link I come up with seems to describe your situation exactly.  There solution was to add "Application.EnableCancelKey = xlDisabled" at the start of the macro.

http://www.mymindleaks.com/blog/article/fix-for-code-execution-has-been-interrupted-in-excel-vba-macros.html

 
Looks like the issue has also been discussed on the microsoft web site as well:
http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/3a5cf3ab-fe20-45d5-912c-bbb249b1e391/
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 37072789
I agree with owitte, if you post some code we can try to replicate it.
0
 

Author Comment

by:f19l
ID: 37072967
Thanks all but HooKooDooKu has found the solution for me.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month18 days, 4 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question