Diactivate shortcut keys

  • Thread starter Thread starter Uddinj1
  • Start date Start date
U

Uddinj1

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
 
Uddinj1 said:
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 *
 
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.
 

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

Back
Top