ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   disable shortcut key from menu control (https://www.excelbanter.com/excel-programming/404851-disable-shortcut-key-menu-control.html)

Caroline

disable shortcut key from menu control
 
Hello,
I would like to prevent the user to use Cut from the menu. I managed to
disable the menu item using the code below, but have not managed to disable
the Shortkey Ctrl+X.
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

Ron de Bruin

disable shortcut key from menu control
 
Note you code is not working correct if the user insert controls

See this page for a way that use the ID
http://www.rondebruin.nl/menuid.htm

See point 3 for the shortcuts
http://www.rondebruin.nl/menuid.htm#useful




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"caroline" wrote in message ...
Hello,
I would like to prevent the user to use Cut from the menu. I managed to
disable the menu item using the code below, but have not managed to disable
the Shortkey Ctrl+X.
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 12:18 AM.

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