ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Command Bar Edit Control (https://www.excelbanter.com/excel-programming/421243-disable-command-bar-edit-control.html)

iperlovsky

Disable Command Bar Edit Control
 
I am attempting to use this sub routine to disable the cut control under the
Edit menu and all the sub menus, but the menu is still allowing me to cut. I
have Excel 2003. Any help is appreciated.

Sub MenuControl_False()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=21)
Ctrl.Enabled = False
Next Ctrl
End Sub


Michael

Disable Command Bar Edit Control
 
You're probably refering to Ctrl X
This is how you do that:
'Divert Ctrl + X = Cut
Application.OnKey "^x", "NoNo"

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"iperlovsky" wrote:

I am attempting to use this sub routine to disable the cut control under the
Edit menu and all the sub menus, but the menu is still allowing me to cut. I
have Excel 2003. Any help is appreciated.

Sub MenuControl_False()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=21)
Ctrl.Enabled = False
Next Ctrl
End Sub


Michael

Disable Command Bar Edit Control
 
Read also this:
http://www.mrexcel.com/archive/VBA/1981.html
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"iperlovsky" wrote:

I am attempting to use this sub routine to disable the cut control under the
Edit menu and all the sub menus, but the menu is still allowing me to cut. I
have Excel 2003. Any help is appreciated.

Sub MenuControl_False()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=21)
Ctrl.Enabled = False
Next Ctrl
End Sub


Michael

Disable Command Bar Edit Control
 
And if you don't want to write the nono sub, do this:
Application.OnKey "^x", ""
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Michael" wrote:

You're probably refering to Ctrl X
This is how you do that:
'Divert Ctrl + X = Cut
Application.OnKey "^x", "NoNo"

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"iperlovsky" wrote:

I am attempting to use this sub routine to disable the cut control under the
Edit menu and all the sub menus, but the menu is still allowing me to cut. I
have Excel 2003. Any help is appreciated.

Sub MenuControl_False()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=21)
Ctrl.Enabled = False
Next Ctrl
End Sub


iperlovsky

Disable Command Bar Edit Control
 
I am trying to disable the "cut" control from all menus in sheet 1.

"Michael" wrote:

You're probably refering to Ctrl X
This is how you do that:
'Divert Ctrl + X = Cut
Application.OnKey "^x", "NoNo"

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"iperlovsky" wrote:

I am attempting to use this sub routine to disable the cut control under the
Edit menu and all the sub menus, but the menu is still allowing me to cut. I
have Excel 2003. Any help is appreciated.

Sub MenuControl_False()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=21)
Ctrl.Enabled = False
Next Ctrl
End Sub


iperlovsky

Disable Command Bar Edit Control
 
I do not know why but none of these "grey out" (ie, disable) the cut command
from all menus in the sheet.

"Michael" wrote:

Read also this:
http://www.mrexcel.com/archive/VBA/1981.html
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"iperlovsky" wrote:

I am attempting to use this sub routine to disable the cut control under the
Edit menu and all the sub menus, but the menu is still allowing me to cut. I
have Excel 2003. Any help is appreciated.

Sub MenuControl_False()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=21)
Ctrl.Enabled = False
Next Ctrl
End Sub


Mike H

Disable Command Bar Edit Control
 
Hi,

All the techniques are described here

http://www.rondebruin.nl/menuid.htm

Mike

"iperlovsky" wrote:

I am attempting to use this sub routine to disable the cut control under the
Edit menu and all the sub menus, but the menu is still allowing me to cut. I
have Excel 2003. Any help is appreciated.

Sub MenuControl_False()
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In Application.CommandBars.FindControls(ID:=21)
Ctrl.Enabled = False
Next Ctrl
End Sub



All times are GMT +1. The time now is 08:22 AM.

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