ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Turn off menu function (https://www.excelbanter.com/excel-programming/421232-turn-off-menu-function.html)

iperlovsky

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

Thanks,

IP

Michael

Turn off menu function
 
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).Dele te
'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, Befo=13

To restore on right click:
Enabled = True

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

Michael Arch.




"iperlovsky" wrote:

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

Thanks,

IP


Michael

Turn off menu function
 
Here is the link to the Control ID's
http://support.microsoft.com/default.aspx/kb/213552
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"Michael" wrote:

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).Dele te
'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, Befo=13

To restore on right click:
Enabled = True

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

Michael Arch.




"iperlovsky" wrote:

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

Thanks,

IP



All times are GMT +1. The time now is 09:10 AM.

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