Right Click Insert Button Not Removing vba

decadence

Well-known Member
Joined
Oct 9, 2015
Messages
525
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2010
  5. 2007
Platform
  1. Windows
Hi, I am having an issue where the Insert... Function is not being removed when I open Excel, However if i run through it manually it will remove it. Doesn't make sense because I have checked the Spelling to match the right click button. See code below


Code:
Private Sub Workbook_Open()
    Application.CommandBars("Cell").Reset
    On Error Resume Next
    With Application
        .CommandBars("Cell").Controls("Name a Range...").Delete
        .CommandBars("Cell").Controls("Pick From Drop-down List...").Delete
        .CommandBars("Cell").Controls("Insert Comment").Delete
        .CommandBars("Cell").Controls("Filter").Delete
        .CommandBars("Cell").Controls("Sort").Delete
        .CommandBars("Cell").Controls("Clear Contents").Delete
        .CommandBars("Cell").Controls("Delete...").Delete
        .CommandBars("Cell").Controls("Paste Special...").Delete
        .CommandBars("Cell").Controls("Insert...").Delete
    End With
    On Error GoTo 0
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    On Error Resume Next
    Application.CommandBars("Cell").Reset
    On Error GoTo 0
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,215,406
Messages
6,124,720
Members
449,184
Latest member
COrmerod

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top