Disable Command Bar Edit Control

I

iperlovsky

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
 
M

Michael

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

Michael

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.
 
I

iperlovsky

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

iperlovsky

Thanks for the tip. I am having difficulty applying this to only a few
designated sheets, rather than to the whole workbook. Any suggestions on that?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Ctrl As Office.CommandBarControl
For Each Ctrl In
Worksheets("PDB_1").Application.CommandBars.FindControls(ID:=21)
Ctrl.Enabled = False
Next Ctrl
End Sub

Thanks,

IP
 

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