Search code examples
ms-officeribbonoffice-interopoffice-2007office-2010

Deploying an add-in for Office 2003 and Office 2007 (with Ribbon support)


I wrote a Word 2003 add-in that uses the 2003 PIAs for early-binding. I want the same executable to support the Ribbon interface in Office 2007 and 2010, while still running in Office 2003.

Is it possible to late-bind the IRibbonExtensibility interface? If not, is there another way to dynamically differentiate between Office versions?


Solution

  • There's a good book on working with the ribbon UI in Office: RibbonX: Customizing the Office 2007 Ribbon Robert Martin, Ken Puls, Teresa Hennig

    The authors and MS both suggest a trick along these lines for solving this problem:

    When your add-in loads, it queries the app to find out what version it's running in.

    If Office 2003, it creates a normal CommandBars 'n Buttons UI.

    If Office 2007 or later, it looks for another add-in and demand-loads it. This second add-in contains just the RibbonX code to create your ribbon UI plus handlers for the button click events. The handler simply calls back to the main add-in.

    With a little clever use of tags in your RibbonXML and handler, you can have a single handler work out which routine in the main add-in to call.