Implement IDTExtensibility2, IRibbonExtensibility interface
for Outlook, Excel in C#, VB.NET, C++

Add-in Express™
for Microsoft® Office and .net

Add-in Express Home >

Implementing IDTExtensibility2 interface

COM add-in programming always starts with implementing the IDTExtensibility2 interface which may present the following difficulties:

  • There are three scenarios of a host application startup. It can be launched: a) by the user interactively b) by another program without a UI through Automation, and c) by the user interactively after another program launched it without a user interface. So your code should allow for all these scenarios.
  • Some host apps (Outlook, Word, Access, MapPoint) have features of their own, which considerably complicates your code in respect of interaction with host applications.
  • You should also have the insight of the Office Object Model, let alone understanding of the host app's object model.

Add-in Express copes with these and many other problems. A considerable part of its code has been written to overpass pitfalls and dubious features of different Office versions, their service packs and hotfixes.

Implementing IRibbonExtensibility interface

In order to customize the Office 2007 and 2010 Ribbon UI, your add-in must implement the IRibbonExtensibility COM interface. This interface provides the only method: GetCustomUI, which returns the XML markup, and then Office loads the customized Ribbon into the application. The markup specifies Ribbon controls, their captions, images, sizes, states, etc. It also specifies callbacks which are just function names that are called when a given Ribbon control is clicked, changed, selected, checked, etc. Creating such a markup requires good knowledge of Ribbon XML and may present a problem. Naturally, every type of Ribbon controls supplies information of its own in their event handlers. Because the compiler doesn't have signatures of such callback functions, it isn't possible to check if this or that function corresponds to the format required by Ribbon XML at compile-time.

These may be minor problems, nevertheless. The fact is that when you implement IRibbonExtensibility yourself, you waste your time on this or that UI problem instead of concentrating on your work. With Add-in Express, you can just step over the Office 2007 and 2010 Ribbon and its controls.

Implementing ICustomTaskPaneConsumer interface

In addition to the IDTExtensibility2 interface, the COM add-in that uses custom task panes must implement the ICustomTaskPaneConsumer interface. It's COM again. The interface exposes the CTPFactoryAvailable method that passes a variable of the ICTPFactory type which is a COM interface. ICTPFactory provides a single method, CreateCTP, which accepts the class ID (CLSID) or program ID (ProgID) of the ActiveX control, it is this control that the user sees when the task pane is shown. To create such an ActiveX, you can use UserControl from the .NET Framework. Add-in Express knows how to create task panes, how to show them, how to free them, and how to solve their inaccuracies.

All in all, if you implement IDTExtensibility2, IRibbonExtensibility, and / or ICustomTaskPaneConsumer in a non-trivial way you have either to be an expert in COM add-in programming or to ask an expert for help. Add-in Express .NET is the expert's answer. Add-in Express hides all straits of low-level COM programming by implementing these interfaces.