ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable a menu control short key (https://www.excelbanter.com/excel-programming/404805-disable-menu-control-short-key.html)

Caroline

disable a menu control short key
 
hello,
I would like to disable the cut control (and its shortkey CtrlX).
I have managed to disable the control by greying the menu item with the
following code but the shortkey still work.
Any idea?
Thanks

Sub preventcut()
' disable cut
Application.CommandBars("Worksheet Menu Bar").Reset
With Application.CommandBars("Worksheet Menu Bar").Controls
.Item(2).Controls(3).Enabled = False
End With
End Sub
Sub resetmenu()
Application.CommandBars("Worksheet Menu Bar").Reset
End Sub



--
caroline

Jim Cone

disable a menu control short key
 

Look up the "OnKey" method in help.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"caroline"
wrote in message
hello,
I would like to disable the cut control (and its shortkey CtrlX).
I have managed to disable the control by greying the menu item with the
following code but the shortkey still work.
Any idea?
Thanks

Sub preventcut()
' disable cut
Application.CommandBars("Worksheet Menu Bar").Reset
With Application.CommandBars("Worksheet Menu Bar").Controls
.Item(2).Controls(3).Enabled = False
End With
End Sub
Sub resetmenu()
Application.CommandBars("Worksheet Menu Bar").Reset
End Sub
--
caroline


All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com