Reset Sheet Tab Context Menu Help

t0ny84

Board Regular
Joined
Jul 6, 2020
Messages
205
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
  2. Mobile
  3. Web
Hi All,
Whilst helping another user with adding additional menus to their context menu (right click menu) in Excel I had added some additional menus to mine but thought I had cleared them all. When I just opened Excel I noticed on the Sheet Tab Context Menu the extra options still show. I was wondering if anyone knows how to reset this Sheet Tab Context Menu? I was able to reset all my other menus using the below code but they aren't working on the Sheet Tab Context Menu. I also found an add-in Menu Righter which removed it but when Excel was restarted they were back.

Code:
Application.CommandBars("Cell").Reset
Application.CommandBars("cell").Enabled = True
Application.CommandBars("Column").Reset
Application.CommandBars("column").Enabled = True
Application.CommandBars("Row").Reset
Application.CommandBars("row").Enabled = True


Thanks in advance,
1599792082149.png

t0ny84
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
WARNING - This will RESET ALL MENUS!

OK I think I have fixed this, the steps are:

1) Copy below VBA Code into VBA Editor and run, this will generate a list of all Control IDs and information.
2) Copy Application.CommandBars( (CELL G1) and ).Reset (Cell H1) to two cells.
3) Delete Duplicates based on Control ID Column.
4) Do Concatenate Formula in empty column and fill down.
=CONCATENATE($G$1,Control ID Cell 1,$H$1)

5) Copy the values from this column and paste into a new SUB then run (you may need to split these and do them a few at a time).
6) Close and reopen Excel.

The menus should now ALL be reset.

Code From - List Excel command bars and controls

VBA Code:
Sub ListCommandBarsAndControls()
    Set ws = ThisWorkbook.Sheets("Sheet1")
    
    ' Create a header on the first row of the spreadsheet
    ws.Rows(1).Cells(1) = "BAR NAME"
    ws.Rows(1).Cells(2) = "BAR VISIBLE"
    ws.Rows(1).Cells(3) = "BAR BUILTIN"
    ws.Rows(1).Cells(4) = "CONTROL ID"
    ws.Rows(1).Cells(5) = "CONTROL CAPTION"
    ws.Rows(1).Cells(6) = "CONTROL ENABLED"
    
    ' Set a variable so the following starts writing on the second row
    targetRow = 2
    
    ' Iterate through all command bars
    For i = 1 To Application.CommandBars.Count

        Set sCmdBar = Application.CommandBars(i)
        ws.Rows(targetRow).Cells(1) = sCmdBar.Name
        ws.Rows(targetRow).Cells(2) = sCmdBar.Visible
        ws.Rows(targetRow).Cells(3) = sCmdBar.BuiltIn
        
        ' And for each command bar, iterate through all the available controls
        For j = 1 To Application.CommandBars(i).Controls.Count
            Set sControl = Application.CommandBars(i).Controls(j)
            ws.Rows(targetRow).Cells(1) = sCmdBar.Name
            ws.Rows(targetRow).Cells(2) = sCmdBar.Visible
            ws.Rows(targetRow).Cells(3) = sCmdBar.BuiltIn
            ws.Rows(targetRow).Cells(4) = sControl.ID
            ws.Rows(targetRow).Cells(5) = sControl.Caption
            ws.Rows(targetRow).Cells(6) = sControl.Enabled
            targetRow = targetRow + 1
        Next j

    Next i

    ' Some times it takes a while to complete so pop up
    ' a message box to make it clear when it's finished
    MsgBox "Complete!"

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,639
Messages
6,120,679
Members
448,977
Latest member
dbonilla0331

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