View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Disabling Commands

Look in help at the OnKey method. This is the way to disable and reset
shortcuts.

--
Regards,
Tom Ogilvy

"Loomah" wrote in message
...
Hi
I'm trying to disable a few commands (like Copy etc).

I'm using the following to address all command bar controls as necessary

Sub Find_Disable_Commands()
Dim myControls As CommandBarControls
Dim ctl As CommandBarControl
Set myControls = CommandBars.FindControls _
(Type:=msoControlButton, ID:=21) 'cut
For Each ctl In myControls
ctl.Enabled = 0
Next ctl
End Sub

The next part is disabling keyboard shortcuts. I'm aware of one way to do
this which is to create a 'blank' macro and assign the keyboard shortcut

to
it, eg assign Ctrl+X to
Sub Kut()
'nothing here!
End Sub

The question is, is this the best way to do this (I 've done it manually)
and if so how do I reset the normal shortcut command when leaving the
workbook ie make Ctrl+X into cut again when closing the book or switching
between books??

Many thanks in advance