"Code Execution has been Interrupted" message appears randomly

K

ksurvell

I've encountered this in various versions of Word (2002, 2003, and 2007) when
running macros.

When the problem occurs, running any macro, no matter how simple, will cause
the message "Code execution has been interrupted" to appear, as if you had
pressed CTRL-BREAK. It will continue to occur throughout the macro, at random
points. If you click "Continue," it will run a little bit more, then break
again. If you click "Break," you will see that execution has stopped on some
random line. I've made several test macros with stuff like "if 1 = 1" that
(presumably) can't fail, yet it will break on those lines as well.

I have tried "clear all breakpoints" in the VBA editor.

I've tried the usual troubleshooting methods: deleting normal.dot, removing
any add-ins, running a detect & repair, etc. No joy with any of them.

I've had limited success with rebooting the computer - but it is not a
sure-fire fix, as it will resolve the problem on some machines but not
others. I suspect that it is just coincidental that rebooting and the problem
going away happen at the same time - or there may be something else going on
that I can't localize.

I cannot cause the problem to occur on demand (I know this makes it really,
really hard to troubleshoot.)

I've exhausted all the troubleshooting steps I can think of. Does anyone
have any suggestions?
 
J

Jean-Guy Marcil

ksurvell was telling us:
ksurvell nous racontait que :
I've encountered this in various versions of Word (2002, 2003, and
2007) when running macros.

When the problem occurs, running any macro, no matter how simple,
will cause the message "Code execution has been interrupted" to
appear, as if you had pressed CTRL-BREAK. It will continue to occur
throughout the macro, at random points. If you click "Continue," it
will run a little bit more, then break again. If you click "Break,"
you will see that execution has stopped on some random line. I've
made several test macros with stuff like "if 1 = 1" that (presumably)
can't fail, yet it will break on those lines as well.

I have tried "clear all breakpoints" in the VBA editor.

I've tried the usual troubleshooting methods: deleting normal.dot,
removing any add-ins, running a detect & repair, etc. No joy with any
of them.

I've had limited success with rebooting the computer - but it is not a
sure-fire fix, as it will resolve the problem on some machines but not
others. I suspect that it is just coincidental that rebooting and the
problem going away happen at the same time - or there may be
something else going on that I can't localize.

I cannot cause the problem to occur on demand (I know this makes it
really, really hard to troubleshoot.)

I've exhausted all the troubleshooting steps I can think of. Does
anyone have any suggestions?

Where are those macros stored? (Which template)

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
K

ksurvell

Jean-Guy Marcil said:
ksurvell was telling us:
ksurvell nous racontait que :


Where are those macros stored? (Which template)

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

The errors occur regardless of where the macros are stored; in normal.dot,
in the currently-open document, in an add-in.
 
K

ksurvell

I've read this (and other) articles on the MVPS website before. I've had no
luck with "code cleaners." The problem occurs even if I delete the
"normal.dot" template and let Word re-create it, and if I remove all
templates & add-ins, and then create a new, blank Word document, put a few
lines of macro code in, and try to run it. In that case, what would I clean -
the unsaved blank document with the new code in it?
 
J

Jean-Guy Marcil

ksurvell was telling us:
ksurvell nous racontait que :
I've read this (and other) articles on the MVPS website before. I've
had no luck with "code cleaners." The problem occurs even if I delete
the "normal.dot" template and let Word re-create it, and if I remove
all templates & add-ins, and then create a new, blank Word document,
put a few lines of macro code in, and try to run it. In that case,
what would I clean - the unsaved blank document with the new code in
it?

And when you performed that blank document test, had you ensured that no
other third-party add-in(s) was(were) also running at the time you executed
the test?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jean-Guy Marcil

ksurvell was telling us:
ksurvell nous racontait que :
Yes. All add-ins were removed and normal.dot had just been re-created
(by Word).

In your original post, you wrote:

"I've had limited success with rebooting the computer - but it is not a
sure-fire fix, as it will resolve the problem on some machines but not
others."

Have you tested these new templates created while only normal.dot was active
(and not other add-ins at all) on other machines?
Did you still get the same error message?


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
K

ksurvell

I'm not necessarily creating templates here - in fact, in most cases I am not
creating templates at all. I'm saving into what is now called a "macro
enabled document." So, they are just documents that contain macros - not
templates or anything special.

On one computer, if the problem occurs, I shut down completely & reboot, and
when I try to run macros again, the problem does not occur. This happens
*without* having to clear normal.dot or remove any of the (several) add-ins
that are on that computer. However, on others, even if I remove all add-ins,
delete normal.dot, and then reboot, the problem will re-occur even if I just
open a blank Word document and write a simple macro.
 
J

Jean-Guy Marcil

ksurvell was telling us:
ksurvell nous racontait que :
I'm not necessarily creating templates here - in fact, in most cases
I am not creating templates at all. I'm saving into what is now
called a "macro enabled document." So, they are just documents that
contain macros - not templates or anything special.

Does this means that this behaviour is observable only on Word 2007?
On one computer, if the problem occurs, I shut down completely &
reboot, and when I try to run macros again, the problem does not
occur. This happens *without* having to clear normal.dot or remove
any of the (several) add-ins that are on that computer. However, on
others, even if I remove all add-ins, delete normal.dot, and then
reboot, the problem will re-occur even if I just open a blank Word
document and write a simple macro.

You have mentioned observing this behaviour on many computers.
Are these computers all part of the same network, hence all configured in
the same way?
Or are these computers all totally unrelated machines, each configured in a
different and unique way across many Word versions?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
K

ksurvell

Jean-Guy Marcil said:
ksurvell was telling us:
ksurvell nous racontait que :


Does this means that this behaviour is observable only on Word 2007?

No, the behavior has been observed in both Word 2003 and Word 2007, with
both old-style Word 97-2003 format documents, as well as Word 2007 "macro
enabled documents" (*.docm).
You have mentioned observing this behaviour on many computers.
Are these computers all part of the same network, hence all configured in
the same way?
Or are these computers all totally unrelated machines, each configured in a
different and unique way across many Word versions?

They are on unrelated machines - the only common factor is that they are
using macros in some way.
 
J

Jean-Guy Marcil

ksurvell was telling us:
ksurvell nous racontait que :
No, the behavior has been observed in both Word 2003 and Word 2007,
with both old-style Word 97-2003 format documents, as well as Word
2007 "macro enabled documents" (*.docm).


They are on unrelated machines - the only common factor is that they
are using macros in some way.

Then I do not know what to say anymore...

If you observed this error message on unrelated machines, using various Word
versions, even after uninstalling all add-ins and recreating Normal.dot...
Then there is some black spell that was cast on you... I have never seen
this message regularly, only at occasion when I did something wrong or had
a corrupt template, and I have never heard of such a situation where one
individual witnesses the same error message on unrelated machines....

Or else, there is something else under the hood you haven't noticed or
forgot to tell us...

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
R

Russ

Are we overlooking the obvious answer, it's a macro virus?
It may be corrupting the Word application to self impose a disable of
running macros.
Is the heritage of the macros being used known?
Are they stored in the "ThisDocument" module or was a new module other than
the "ThisDocument" module used to store the macros in the document?
 
J

Jean-Guy Marcil

Russ was telling us:
Russ nous racontait que :
Are we overlooking the obvious answer, it's a macro virus?
It may be corrupting the Word application to self impose a disable of
running macros.

I doubt it, unless he is not telling the whole story.
See a few replies up the thread when he stated:

"I've read this (and other) articles on the MVPS website before. I've had no
luck with "code cleaners." The problem occurs even if I delete the
"normal.dot" template and let Word re-create it, and if I remove all
templates & add-ins, and then create a new, blank Word document, put a few
lines of macro code in, and try to run it. In that case, what would I
clean -
the unsaved blank document with the new code in it?"
Is the heritage of the macros being used known?
Are they stored in the "ThisDocument" module or was a new module
other than the "ThisDocument" module used to store the macros in the
document?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
R

Russ

Another one of his statements was:
The only common factors among his various machines and various versions of
Word would appear to be the running of macros and his network, if they are
connected, which makes it seem like a virus. Maybe a anti-virus program
could fix it, but all Word apps or certain Word .dlls on his network might
be corrupted.
On networks, is there one master watchdog (Policy Service?) that handles
macro security?
Maybe that watchdog, if it exists, is corrupted because that would also
explain multiple versions and machines having the same problem.
 
K

ksurvell

I suspected a macro virus as well, but the systems are not physically
connected, and they use different anti-virus programs (I've seen the symptoms
on computers running Norton, McAffee, and AVG).

The only commonality is that the computers in question are opening a
document that contains macros. (Actually, a set of documents that all contain
macros, in both ThisDocument and in modules.)

I've run code cleaners on the documents themselves, wondering if they've
become corrupted somehow, but I cannot tie it down to one document - and once
the problem occurs, it occurs no matter what document is opened. And again,
I've deleted normal.dot, and removed all add-ins, so... ?
 
J

Jean-Guy Marcil

Russ was telling us:
Russ nous racontait que :
Another one of his statements was:

The only common factors among his various machines and various
versions of Word would appear to be the running of macros and his
network, if they are connected, which makes it seem like a virus.
Maybe a anti-virus program could fix it, but all Word apps or certain
Word .dlls on his network might be corrupted.
On networks, is there one master watchdog (Policy Service?) that
handles macro security?
Maybe that watchdog, if it exists, is corrupted because that would
also explain multiple versions and machines having the same problem.

Ah, yes, he did not write that all the different computers he had tested
where on the same network, but that is definitely a possibility.

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
W

wanderez ici

I re-installed code and restarted the system. Now the macro is running without any hitch.



ksurvel wrote:

"Code Execution has been Interrupted" message appears randomly
29-May-07

I've encountered this in various versions of Word (2002, 2003, and 2007) when
running macros.

When the problem occurs, running any macro, no matter how simple, will cause
the message "Code execution has been interrupted" to appear, as if you had
pressed CTRL-BREAK. It will continue to occur throughout the macro, at random
points. If you click "Continue," it will run a little bit more, then break
again. If you click "Break," you will see that execution has stopped on some
random line. I've made several test macros with stuff like "if 1 = 1" that
(presumably) can't fail, yet it will break on those lines as well

I have tried "clear all breakpoints" in the VBA editor

I've tried the usual troubleshooting methods: deleting normal.dot, removing
any add-ins, running a detect & repair, etc. No joy with any of them

I've had limited success with rebooting the computer - but it is not a
sure-fire fix, as it will resolve the problem on some machines but not
others. I suspect that it is just coincidental that rebooting and the problem
going away happen at the same time - or there may be something else going on
that I can't localize

I cannot cause the problem to occur on demand (I know this makes it really,
really hard to troubleshoot.

I've exhausted all the troubleshooting steps I can think of. Does anyone
have any suggestions?

Previous Posts In This Thread:

"Code Execution has been Interrupted" message appears randomly
I've encountered this in various versions of Word (2002, 2003, and 2007) when
running macros.

When the problem occurs, running any macro, no matter how simple, will cause
the message "Code execution has been interrupted" to appear, as if you had
pressed CTRL-BREAK. It will continue to occur throughout the macro, at random
points. If you click "Continue," it will run a little bit more, then break
again. If you click "Break," you will see that execution has stopped on some
random line. I've made several test macros with stuff like "if 1 = 1" that
(presumably) can't fail, yet it will break on those lines as well

I have tried "clear all breakpoints" in the VBA editor

I've tried the usual troubleshooting methods: deleting normal.dot, removing
any add-ins, running a detect & repair, etc. No joy with any of them

I've had limited success with rebooting the computer - but it is not a
sure-fire fix, as it will resolve the problem on some machines but not
others. I suspect that it is just coincidental that rebooting and the problem
going away happen at the same time - or there may be something else going on
that I can't localize

I cannot cause the problem to occur on demand (I know this makes it really,
really hard to troubleshoot.

I've exhausted all the troubleshooting steps I can think of. Does anyone
have any suggestions?

Re: "Code Execution has been Interrupted" message appears randomly
ksurvell was telling us
ksurvell nous racontait que

Where are those macros stored? (Which template

--

Salut
______________________________________
Jean-Guy Marcil - Word MV
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

Re: "Code Execution has been Interrupted" message appears randomly

The errors occur regardless of where the macros are stored; in normal.dot
in the currently-open document, in an add-in.

Re: "Code Execution has been Interrupted" message appears randomly
Time to do some cleanups in both templates and VBA project
http://word.mvps.org/FAQs/MacrosVBA/TemplateBloat.ht

and google around on VBA Code Cleaners to get you tool
to clean up VBA code

-
Krgrds
Perr

System
Vista/Office Ultimat
VS2005/VSTO2005 SE



"ksurvell" <[email protected]> schreef in bericht

I've read this (and other) articles on the MVPS website before.
I've read this (and other) articles on the MVPS website before. I've had no
luck with "code cleaners." The problem occurs even if I delete the
"normal.dot" template and let Word re-create it, and if I remove all
templates & add-ins, and then create a new, blank Word document, put a few
lines of macro code in, and try to run it. In that case, what would I clean -
the unsaved blank document with the new code in it?

:

Re: "Code Execution has been Interrupted" message appears randomly
ksurvell was telling us:
ksurvell nous racontait que :


And when you performed that blank document test, had you ensured that no
other third-party add-in(s) was(were) also running at the time you executed
the test?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

Yes. All add-ins were removed and normal.
Yes. All add-ins were removed and normal.dot had just been re-created (by
Word).

:

Re: "Code Execution has been Interrupted" message appears randomly
ksurvell was telling us:
ksurvell nous racontait que :


In your original post, you wrote:

"I've had limited success with rebooting the computer - but it is not a
sure-fire fix, as it will resolve the problem on some machines but not
others."

Have you tested these new templates created while only normal.dot was active
(and not other add-ins at all) on other machines?
Did you still get the same error message?


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

I'm not necessarily creating templates here - in fact, in most cases I am not
I'm not necessarily creating templates here - in fact, in most cases I am not
creating templates at all. I'm saving into what is now called a "macro
enabled document." So, they are just documents that contain macros - not
templates or anything special.

On one computer, if the problem occurs, I shut down completely & reboot, and
when I try to run macros again, the problem does not occur. This happens
*without* having to clear normal.dot or remove any of the (several) add-ins
that are on that computer. However, on others, even if I remove all add-ins,
delete normal.dot, and then reboot, the problem will re-occur even if I just
open a blank Word document and write a simple macro.

:

Re: "Code Execution has been Interrupted" message appears randomly
ksurvell was telling us:
ksurvell nous racontait que :


Does this means that this behaviour is observable only on Word 2007?


You have mentioned observing this behaviour on many computers.
Are these computers all part of the same network, hence all configured in
the same way?
Or are these computers all totally unrelated machines, each configured in a
different and unique way across many Word versions?

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

Re: "Code Execution has been Interrupted" message appears randomly
:


No, the behavior has been observed in both Word 2003 and Word 2007, with
both old-style Word 97-2003 format documents, as well as Word 2007 "macro
enabled documents" (*.docm).


They are on unrelated machines - the only common factor is that they are
using macros in some way.

Re: "Code Execution has been Interrupted" message appears randomly
ksurvell was telling us:
ksurvell nous racontait que :


Then I do not know what to say anymore...

If you observed this error message on unrelated machines, using various Word
versions, even after uninstalling all add-ins and recreating Normal.dot...
Then there is some black spell that was cast on you... I have never seen
this message regularly, only at occasion when I did something wrong or had
a corrupt template, and I have never heard of such a situation where one
individual witnesses the same error message on unrelated machines....

Or else, there is something else under the hood you haven't noticed or
forgot to tell us...

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

Are we overlooking the obvious answer, it's a macro virus?
Are we overlooking the obvious answer, it's a macro virus?
It may be corrupting the Word application to self impose a disable of
running macros.
Is the heritage of the macros being used known?
Are they stored in the "ThisDocument" module or was a new module other than
the "ThisDocument" module used to store the macros in the document?


--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Re: "Code Execution has been Interrupted" message appears randomly
Russ was telling us:
Russ nous racontait que :


I doubt it, unless he is not telling the whole story.
See a few replies up the thread when he stated:

"I've read this (and other) articles on the MVPS website before. I've had no
luck with "code cleaners." The problem occurs even if I delete the
"normal.dot" template and let Word re-create it, and if I remove all
templates & add-ins, and then create a new, blank Word document, put a few
lines of macro code in, and try to run it. In that case, what would I
clean -
the unsaved blank document with the new code in it?"


--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

Re: "Code Execution has been Interrupted" message appears randomly
Another one of his statements was:

The only common factors among his various machines and various versions of
Word would appear to be the running of macros and his network, if they are
connected, which makes it seem like a virus. Maybe a anti-virus program
could fix it, but all Word apps or certain Word .dlls on his network might
be corrupted.
On networks, is there one master watchdog (Policy Service?) that handles
macro security?
Maybe that watchdog, if it exists, is corrupted because that would also
explain multiple versions and machines having the same problem.


--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

I suspected a macro virus as well, but the systems are not physically
I suspected a macro virus as well, but the systems are not physically
connected, and they use different anti-virus programs (I've seen the symptoms
on computers running Norton, McAffee, and AVG).

The only commonality is that the computers in question are opening a
document that contains macros. (Actually, a set of documents that all contain
macros, in both ThisDocument and in modules.)

I've run code cleaners on the documents themselves, wondering if they've
become corrupted somehow, but I cannot tie it down to one document - and once
the problem occurs, it occurs no matter what document is opened. And again,
I've deleted normal.dot, and removed all add-ins, so... ?

:

Re: "Code Execution has been Interrupted" message appears randomly
Russ was telling us:
Russ nous racontait que :


Ah, yes, he did not write that all the different computers he had tested
where on the same network, but that is definitely a possibility.

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org

code execution has been interrupted
We have observed this behavior in MS Excel 2003 as well. Macros break in random spots for no apparent reasons.


Submitted via EggHeadCafe - Software Developer Portal of Choice
BizTalk Repeating Structures Table Looping and Table Extract
http://www.eggheadcafe.com/tutorial...0-a5704fe31a76/biztalk-repeating-structu.aspx
 
S

Suresh babu

Put this as the first statement in your code:
Application.EnableCancelKey = xlDisabled (For Excel)
Application.EnableCancelKey = wdCancelDisabled (For Word)
Now u won't get the interruption message.



wanderez ici wrote:

"Code Execution has been Interrupted"
13-Apr-10

I re-installed code and restarted the system. Now the macro is running without any hitch.

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
BizTalk: Conditional looping incorporating the Greater Than functoid.
http://www.eggheadcafe.com/tutorial...2d-043c18df964c/biztalk-conditional-loop.aspx
 
D

Don

Application.EnableCancelKey = xlDisabled works HOWEVER if your macro is long there is a chance it will automatically enable itself while executing the code. So obviously in this case you'll have to put perhaps several "Application.EnableCancelKey = xlDisabled" commands in your macro to allow it to run smoothly. But I don't like these solutions. There must be a Windows OS API that will do a better job of disabling the cancel keys. After all it's probably being automatically executed by the OS as a security measure. Any know?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top