Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Disabling saving | Excel Worksheet Functions | |||
Disabling Cut and Copy | Excel Discussion (Misc queries) | |||
Disabling formula | Excel Discussion (Misc queries) | |||
disabling shorcuts | Excel Programming | |||
Auto_Open disabling | Excel Programming |