Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Code execution has been interrupted

Is there a way to prevent the "Code execution has been interrupted" error?
I'm thinking there is not, but perhaps my code is incomplete or inadequate.

A worksheet has the following event handler: (A similar handler exists for
the workbook.)

Private Sub Worksheet_Deactivate()
'Redisplay Formula Bar when changing to another worksheet
On Error Resume Next
Application.DisplayFormulaBar = True
End Sub

When I start to Alt-Tab to change to another window and use the Esc key to
change my mind then the Esc key must be pressed a second time to avoid the
interruption error when any code is executed. Of course, code will be
executed if I change worksheets, workbooks, click a button, etc.

Any suggestions?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 301
Default Code execution has been interrupted

Put this as the first statement in your code:
Application.EnableCancelKey = xlDisabled
this effectively turns off the esc key, but if you have a real problem, like
a loop, you would have to ctrl/alt/delete to stop it.

"AnExpertNovice" wrote in message
...
Is there a way to prevent the "Code execution has been interrupted" error?
I'm thinking there is not, but perhaps my code is incomplete or

inadequate.

A worksheet has the following event handler: (A similar handler exists for
the workbook.)

Private Sub Worksheet_Deactivate()
'Redisplay Formula Bar when changing to another worksheet
On Error Resume Next
Application.DisplayFormulaBar = True
End Sub

When I start to Alt-Tab to change to another window and use the Esc key to
change my mind then the Esc key must be pressed a second time to avoid the
interruption error when any code is executed. Of course, code will be
executed if I change worksheets, workbooks, click a button, etc.

Any suggestions?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Code execution has been interrupted

Interesting command. It is the Alt-tab + Esc that causes the problem. A
second Esc prevents it. Plus, the problem is caused when no code is
executing and the problem manifests itself when code begins to execute.

Application.EnableCancelKey will be set to xlInterrupt state when the
problem is caused and when it rears it's ugly message box.

Thanks for the command. I can see uses for this one.

--
My handle should tell you enough about me. I am not an MVP, expert, guru,
etc. but I do like to help.


"Bob Umlas" wrote in message
...
Put this as the first statement in your code:
Application.EnableCancelKey = xlDisabled
this effectively turns off the esc key, but if you have a real problem,

like
a loop, you would have to ctrl/alt/delete to stop it.

"AnExpertNovice" wrote in message
...
Is there a way to prevent the "Code execution has been interrupted"

error?
I'm thinking there is not, but perhaps my code is incomplete or

inadequate.

A worksheet has the following event handler: (A similar handler exists

for
the workbook.)

Private Sub Worksheet_Deactivate()
'Redisplay Formula Bar when changing to another worksheet
On Error Resume Next
Application.DisplayFormulaBar = True
End Sub

When I start to Alt-Tab to change to another window and use the Esc key

to
change my mind then the Esc key must be pressed a second time to avoid

the
interruption error when any code is executed. Of course, code will be
executed if I change worksheets, workbooks, click a button, etc.

Any suggestions?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code Execution Has Been Interrupted LCK[_2_] Excel Programming 2 November 18th 05 12:25 AM
Code execution has been interrupted Red[_4_] Excel Programming 3 October 6th 05 06:26 AM
Code execution has been interrupted Who I Am Excel Programming 5 September 28th 05 03:32 PM
code execution has been interrupted del Excel Discussion (Misc queries) 0 September 3rd 05 12:22 PM


All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"