Remove 2003 custom toolbar from Excel 2007
Posted on 2010-09-10
I have an application with an Excel workbook as the user interface. I am migrating it from 2003 to 2007. In 2003, I had a custom toolbar with three buttons to run specified procedures. In the Workbook_Open event I used the following code to assign the procedures to the toolbar buttons
'assign macros(functions) to custom toolbar buttons
'constants declared/assigned top of this module
'Excel.CommandBars(TOOLBAR).Controls(1).OnAction = LINKMACRO
'Excel.CommandBars(TOOLBAR).Controls(2).OnAction = REFRESHMACRO
'Excel.CommandBars(TOOLBAR).Controls(3).OnAction = UPDATEMACRO
'display custom toolbar
'Application.CommandBars("RunCode").Visible = True
For 2007 I've modified the Ribbon to include buttons to do the same and am now wanting to remove the custom toolbar (which appears as a custom Add-Ins tab in the Ribbon). I can't for the life of me figure out how to remove it. I've tried
Renaming/deleting the Excel12.xlb file from the C:\Users\username\AppData\Roaming\Microsoft\Excel folder
Right-clicking the custom menu items in the Add-Ins tab and choosing delete (the tab disappears but reappears the next time I open the workbook).
The workaround I am using right now is to issue the following on the Workbook)Open even
Which works but if I remove that line of code the Add-Ins tab is back with the custom toolbar items.
I've looked at the attachedToolbars.bin file in Notepad and see that it contains
R u n C o d e ÷L f kÎ Åü þ÷L f kÎ Åü þ÷L f kÎ Åü ÿ …3 ¨ A & A c t i v a t e L i n k s T h i s W o r k b o o k . A d d H y p e r l i n k € …2 ¨ A & R e f r e s h D a t a T h i s W o r k b o o k . R e f r e s h S h e e t s € …2 ¨ A & U p d a t e D a t a b a s e T h i s W o r k b o o k . U p d a t e D a t a b a s e €
These are the three custom toolbars and the respective procedures they are connected to. I cannot delete the file however.