I\'m wondering if it\'s possible to detect when a user has clicked the Header/Footer button in Excel so I can show some custom header/footer related ribbon controls on my add-in
One way I've discovered that worked was to use the <commands>
section in the Ribbon XML (which I didn't know existed.) Apparently this mechanism allows you to re-purpose actions intrinsic to Excel but beware that not all controls support re-purposing the onAction callback)
<?xml version="1.0" encoding="UTF-8"?>
<customUI onLoad="Ribbon_Load" xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<commands>
<command idMso="HeaderFooterInsert" onAction="testHeaderFooter"/>
</commands>
<ribbon>
<tabs>...
along with the associated event handler:
public void testHeaderFooter(Office.IRibbonControl control, bool cancelDefault)
{
MessageBox.Show("Testing.");
cancelDefault = false;
}
This link was very helpful:
http://social.msdn.microsoft.com/Forums/office/en-US/e1a60d16-053e-4697-b17c-b22d602f0400/intercept-the-onaction-event-of-a-gallery-element-of-excel-2007-ui-ribbon?forum=vsto