ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Diactivate shortcut keys (https://www.excelbanter.com/excel-programming/309630-diactivate-shortcut-keys.html)

Uddinj1

Diactivate shortcut keys
 
Hi
Thanks in advance.

Is there a way to diactivate the keyboard shortcuts while a specific workbbok
is open, so that if the user press e.g. Ctrl+C it would not work. Thanks.

Regards


Rob Bovey

Diactivate shortcut keys
 
"Uddinj1" wrote in message
...
Is there a way to diactivate the keyboard shortcuts while a specific

workbbok
is open, so that if the user press e.g. Ctrl+C it would not work. Thanks.


You can use Application.OnKey to do this. Run the following line when
your workbook opens, either in the Auto_Open procedure or Workbook_Open
event:

Application.OnKey "^c", ""

This disables Ctrl+C copying. To enable it again when your workbook closes
add the following line to the Auto_Close procedure or Workbook_BeforeClose
event:

Application.OnKey "^c"

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *



Tom Ogilvy

Diactivate shortcut keys
 
Look in the Excel VBA help for SendKeys. It tells you how to do that. You
would have to put the appropriate code in the workbook level activate and
deactivate events.

--
Regards,
Tom Ogilvy

"Uddinj1" wrote in message
...
Hi
Thanks in advance.

Is there a way to diactivate the keyboard shortcuts while a specific

workbbok
is open, so that if the user press e.g. Ctrl+C it would not work. Thanks.

Regards





All times are GMT +1. The time now is 08:05 AM.

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