View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Loomah Loomah is offline
external usenet poster
 
Posts: 18
Default Disabling Commands

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