I am using VSTO Deveopment | Excel 2007 | C#. Is there any event to identify that the tab selection in excel ribbon has changed ?
Asked
Active
Viewed 4,733 times
2 Answers
2
In VSTO2010, the ability to programmatically switch the selected tab was added. Norm Estabrook blogged about it.
this.RibbonUI.ActivateTabMso("TabAddIns");
So while there isn't an event that can be latched onto, at least you can switch the selected tab. For instance, I'm going to use the sheet selection event; when users switch between different sheets of my workbook, I am going to change their selected tab. Each sheet will correspond to a different ribbon tab.

Peder Rice
- 1,764
- 3
- 28
- 51
1
No.

Community
- 1
- 1

Peter Majeed
- 5,304
- 2
- 32
- 57
-
This question is only in reference to VSTO with Office 2007. I am having trouble finding information on Office 2010; any ideas? – Peder Rice Feb 03 '12 at 17:50
-
1@PederRice: The Office 2010 model also doesn't expose the `change` event of ribbon tabs, but the linked answer *does* demonstrate how to speak to the Ribbon via Microsoft Active Accessibilty. I'm only passingly familiar with MSAA, so there may be a way there to access the `change` event. – Peter Majeed Feb 03 '12 at 18:12
-
Thanks for the info. I'm attaching another about programmatically switching tabs below, which might provide a workaround in some situations – Peder Rice Feb 06 '12 at 20:50
-
@PederRice: That part is included in the linked answer, but again, the `ActivateTab` method isn't a workaround for identifying the, for lack of an official term, `Focused` property of a given `RibbonTab`. Changing the ribbon to become what you want is entirely unrelated to asking the ribbon *what it already is* (i.e. `get` vs. `set`). The only possibility of `get`ting ribbon information, as it stands today, is via MSAA. Moreover, the OP asked about Excel 2007, to which `ActivateTab` does not apply. – Peter Majeed Feb 06 '12 at 21:35
-
That is a good point, @PeterMajeed. I just wanted to make sure people understand that there might be workarounds, depending on their scenario, as I mentioned in my answer. You just might have to get a bit creative. – Peder Rice Feb 10 '12 at 16:31
-
@PederRice: If only MS's Excel team were as creative (on this point!)... :) – Peter Majeed Feb 10 '12 at 18:05