ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OnKey query (https://www.excelbanter.com/excel-programming/338828-onkey-query.html)

Libby

OnKey query
 
Hi Folks

I know you can use Application.OnKey "^c","" to disable the Ctrl C copy
shortcut.

I'd like to be able to disable the Ctrl Break that interrupts code execution.

I've tried the following line of code in the Workbook Open event, but it
doesn't seem to work, although no errors occur.

Application.OnKey "^{BREAK}",""

Many thanks in Advance

Tom Ogilvy

OnKey query
 
Look at application.Cancelkey perhaps that will work for you.

--
Regards,
Tom Ogilvy

"Libby" wrote in message
...
Hi Folks

I know you can use Application.OnKey "^c","" to disable the Ctrl C copy
shortcut.

I'd like to be able to disable the Ctrl Break that interrupts code

execution.

I've tried the following line of code in the Workbook Open event, but it
doesn't seem to work, although no errors occur.

Application.OnKey "^{BREAK}",""

Many thanks in Advance




Dave Peterson

OnKey query
 
Take a look at:
Application.EnableCancelKey
in VBA's help.

Note the warning.

Libby wrote:

Hi Folks

I know you can use Application.OnKey "^c","" to disable the Ctrl C copy
shortcut.

I'd like to be able to disable the Ctrl Break that interrupts code execution.

I've tried the following line of code in the Workbook Open event, but it
doesn't seem to work, although no errors occur.

Application.OnKey "^{BREAK}",""

Many thanks in Advance


--

Dave Peterson

Tom Ogilvy

OnKey query
 
As Dave said, it is actually EnableCancelKey - Bad brain to hand connection.
:(

--
Regards,
Tom Ogilvy
"Tom Ogilvy" wrote in message
...
Look at application.Cancelkey perhaps that will work for you.

--
Regards,
Tom Ogilvy

"Libby" wrote in message
...
Hi Folks

I know you can use Application.OnKey "^c","" to disable the Ctrl C

copy
shortcut.

I'd like to be able to disable the Ctrl Break that interrupts code

execution.

I've tried the following line of code in the Workbook Open event, but it
doesn't seem to work, although no errors occur.

Application.OnKey "^{BREAK}",""

Many thanks in Advance







All times are GMT +1. The time now is 02:55 PM.

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