Interrupts

N

Neptune Dinosaur

G'day

I think this might be a bit of an unusual one. I have a clue as to what may
be causing it, so I'll give the symptoms first and then the clue

SYMPTOMS : I am getting Interrupts frequently. These are not trappable,
but this may only be because of an environmental state that I have created.
The box says "Code execution has been interrupted". All four buttons are
availalble - Continue -- End -- Debug -- Help. This is happening without the
user pressing Ctrl-Break and it only seems to be happening immediately after
a code line that takes longer than most to execute, e.g. a SaveAs or a
Selection.Printout. If you Debug, it takes you to the line after that, but
I'm positive that that isn't the problem line - it happens regardless of the
type of line (e.g. a simple cell select, an Exit Sub and an
Application.Wait). It seems to be with the preceding "longer execution" line.

POSSIBLE CLUE : For the purposes of a "tutorial" that I run within a
particular Excel file, I am manipulating the Application.EnableCancelKey in
order to make the Ctrl-Break event trappable. The tute is really just a
normal Sub, but it has loads of Application.Wait lines and lots of "OK only"
message boxes. At the start of the tute Sub, I change EnableCancelKey to
"xlErrorHandler" (value 2) and I change it back to "xlInterrupt" (value 1) at
all possible exit points (I gather that Excel reverts it to xlInterrupt by
itself, but I do it explicitly anyway).

In any case, if I test the EnableCancelKey status before and after the
problem, I always get the Value "1", which seems to be normal. I should
point out the the Interrupt problem is happening in other Excel files as well
as the one that has the tute.

Does anyone have any ideas? Is the EnableCancelKey issue a red herring, or
have I somehow changed my environment?
 
N

Neptune Dinosaur

More information on my "Interrupt" problem. The unexpected Interrupts are
only happening on one machine - the one on which I wrote and tested the Sub
that fiddles around with the EnableCancelKey property (I am on a large
network). This is obviously some kind of clue ...
 

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