ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Ctrl-Break (https://www.excelbanter.com/excel-programming/388800-disable-ctrl-break.html)

Nigel

Disable Ctrl-Break
 
Two questions....

How can I disable the Ctrl-Break key strokes to prevent stopping code when
it is running?

If I do disable the Ctrl-Break - is there a way I can set up my own 'break'
command sequence to stop the code running?


Thanks

--
Cheers
Nigel





Norman Jones

Disable Ctrl-Break
 
Hi Nigel,

See VBA help for the EnableCancelKey property.


---
Regards,
Norman



"Nigel" wrote in message
...
Two questions....

How can I disable the Ctrl-Break key strokes to prevent stopping code when
it is running?

If I do disable the Ctrl-Break - is there a way I can set up my own
'break' command sequence to stop the code running?


Thanks

--
Cheers
Nigel







Mike H

Disable Ctrl-Break
 
Try this


sub nobreak()
Application.EnableCancelKey = wdCancelDisabled
your code
Application.EnableCancelKey = wdCancelInterrupt
end sub

Mike
"Nigel" wrote:

Two questions....

How can I disable the Ctrl-Break key strokes to prevent stopping code when
it is running?

If I do disable the Ctrl-Break - is there a way I can set up my own 'break'
command sequence to stop the code running?


Thanks

--
Cheers
Nigel






Norman Jones

Disable Ctrl-Break
 
Hi Nigel,

If I do disable the Ctrl-Break - is there a way I can set up my own
'break' command sequence to stop the code running?


To specifically address the second question, VBA help
provides an example of the use of a custom cancellation
handler.


---
Regards,
Norman
Microsoft Excel MVP



Nigel

Disable Ctrl-Break
 
Many thanks - all is now clear

--
Cheers
Nigel



"Norman Jones" wrote in message
...
Hi Nigel,

If I do disable the Ctrl-Break - is there a way I can set up my own
'break' command sequence to stop the code running?


To specifically address the second question, VBA help
provides an example of the use of a custom cancellation
handler.


---
Regards,
Norman
Microsoft Excel MVP





All times are GMT +1. The time now is 12:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com