Search code examples
c#ms-wordms-officevstooffice-interop

Get event on any tab click in ribbon in MS word VSTO add in


I have created a MsWordAddin using VSTO addin in visual studio for MS Office 2010.Till now I have added a new tab in Ribbon and customized task Pane. What now I want is to get a event when user select any tab on Ribbon,so i can evaluate what user has performed on this event e.g. user select Page layout tab and change Page orientation from horizontal to landscape.

I found SelectionChange,BeforeRightClick,BeforeDoubleClick document events,but they are not what i want.

Is there any way to get event in MS Word or any other workaround to evaluate such scenario ?


I want to evaluate as same way as RibbonHero Hope this clears my question very well.


Solution

  • No, the Fluent UI (aka Ribbon UI), nor the Word object model, doesn't provide any event for that. If you have got your add-in's controls on a particular tab you may consider handling callbacks that should be fired when the tab is going to be shown.

    so i can evaluate what user has performed on this event e.g. user select Page layout tab and change Page orientation from horizontal to landscape.

    Instead, I'd suggest handling the Document's events.