Turn off menu function

  • Thread starter Thread starter iperlovsky
  • Start date Start date
I

iperlovsky

Anyone know the code to turn off a certain menu function, say "cut", under
the edit menu in a particular worksheet?

Thanks,

IP
 
In order to remove a command from the Menu, you need to now the control ID
For Example:
'This command will remove not really delete the Move or copy sheet from the

edit bar
ThisWorkbook.CommandBars("Edit").Controls(13).Delete
'This command will disable the right click version of moving or copying the
sheet
Set modfctrl = CommandBars(35).FindControl(ID:=848)
With modfctrl
If .ID = 848 Then
.Enabled = False
End If
End With
To Restore into main edit bar do this:
Application.CommandBars("Edit").Controls.Add Type:=msoControlButton, ID:= _
848, Before:=13

To restore on right click:
Enabled = True
 

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

Back
Top