Question

I am looking for a way to hide all the buttons from the Excel context menu and just leave my buttons I created.

How can I do that?

Was it helpful?

Solution

I found a way to do this, When i got same problem..

If you want to remove any item

Sub RemoveItems()
    Application.CommandBars("Cell").Controls("Insert...").Delete
    Application.CommandBars("Cell").Controls("Cut").Delete
    Application.CommandBars("Cell").Controls("Copy").Delete
End Sub

Or if you want to delete all items then

Sub DeleteAll()
Set CtrlMenu = Application.CommandBars("Cell")
For Each Item In CtrlMenu.Controls
Item.Delete
Next
End Sub

If you want to restore again

Sub ResetMenu()
    Application.CommandBars("Cell").Reset
End Sub
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top