Disabling Commands

L

Loomah

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
 
T

Tom Ogilvy

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

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

Top