Modify custom add-in toolbar

lottrup

New Member
Joined
Mar 9, 2009
Messages
16
Hi,

I've had the pleasure of maintaining a custom add-in toolbar for Excel. I'm quite familiar with VBA and Excel in general, but in this case I'm close to being lost.

In the VBA code of the add-in I can see all code (subs) associated with the toolbar/ribbon controls, but I cannot see the code of the ribbon. To clearify, the code that I can see is of the type

Code:
Dim m_Ribbon As IRibbonUI
Sub ribb******ed(ribbon As IRibbonUI)
    'Callback for Office.IRibbonExtensibility.customUI.******
    'MsgBox "The Ribbon is being loaded!"
    Set m_Ribbon = ribbon
End Sub
Sub myButton_ClickHandler(control As IRibbonControl)
MsgBox "MyButton was clicked!"
End Sub
'Callback for Btn_Style40 onAction
Sub Style40_Btn(control As IRibbonControl)
Call Style40
End Sub
'Callback for Btn_Style2 onAction
Sub Style2_Btn(control As IRibbonControl)
Call Style2
End Sub
end

My actual question is: How can I add new controls to the toolbar or rearrange existing controls? I guess there could be some hidden code loading the ribbon on open?

I hope you can help me :)
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
in excel 2007 onwards the custom toolbar ribbon stuff is hidden in a file outside of excel, here is how to find it

locate the excel file, for example myfile.xlsx or myfile.xlsm, rename this file to myfile.zip, double click and open this file, within here you will find a folder called customUI.xml, open folder and within you should find an XML of the same name, extract this and open with notepad here is a sample

oops tried to show code but the xml screwed up the post

you define yuour buttons, macro to call, and an optional button image, once edited you have to drag the file back in, possibly by deleting old one and dragging in edited one, then reverse the file renaming process, back to xlsx or xlsm

there are articles to be found on google, cos that is where I found out how to do it
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,703
Members
452,938
Latest member
babeneker

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