Customizing Office 2007 Ribbons and ribbon controls in
C#, C++, VB.NET - tips for developers
Add-in Express
for Microsoft .net
Add-in Express Home > Add-in Express.NET > Online Guide > Office 2007 Ribbon tips
Office 2007 ribbons tips
Add-in Express provides a visual designer for customizing Office 2007 Ribbon tabs. It also offers special features for advanced customization of Office 2007 Ribbon UI, Quick Access Toolbar and Office Menu. On this page you can find some tips about dealing with Office 2007 ribbons and ribbon controls.
- Being Ribboned
- Sharing Ribbon controls across multiple add-ins
- Built-in and custom command bars in Ribboned Office 2007 applications
Being Ribboned
Find IDs of built-in Ribbon controls in 2007 Office System Document: Lists of Control IDs at Microsoft web-site.
Sharing Ribbon controls across multiple add-ins
First off, you assign a string value to the Namespace property of AddinModule. This makes Add-in Express add two xmlns attributes to the customUI tag in the resulting Xml markup:
- xmlns:default="%ProgId of your add-in, see the ProgID attribute of the AddinModule class%"
- xmlns:shared="%the value of the AddinModule.Namespace property%".
Originally, all the Ribbon controls are located in the default namespace (id="%Ribbon control's id%" or idQ="default:%Ribbon control's id%") and you have full control over them via callbacks provided by Add-in Express. When you specify the Namespace property, Add-in Express changes the markup to use idQ's instead of id's.
Then, in all the add-ins that are to share an Office 2007 Ribbon control, for the control with the same Id (you can change the Id's to match), you set the Shared property to True. For the Ribbon control whose Shared property is True, Add-in Express changes its idQ to use the shared namespace (idQ="shared:%Ribbon control's id%") instead of the default one. Also, for such Ribbon controls, Add-in Express cuts out all the callbacks and replaces them with "static" versions of the attributes. Say, getVisible="getVisible_CallBack" will be replaced with visible="%value%".
The shareable Ribbon controls are the following Ribbon container controls:
- Ribbon Tab - ADXRibbonTab
- Ribbon Box - ADXRibbonBox
- Ribbon Group - ADXRibbonGroup
- Ribbon Button Group - ADXRibbonButtonGroup
When referring to a shared Office 2007 Ribbon control in the BeforeId and AfterId properties of another Ribbon control, you use the shared controls' idQ: %namespace abbreviation% + ":" + %control id%. The abbreviations of these namespaces are "default" and "shared" string values. The resulting XML markup may look like this:
customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
xmlns:default="MyOutlookAddin1.AddinModule"
xmlns:shared="MyNameSpace" [callbacks omitted]>
<ribbon>
<tabs>
<tab idQ=" shared:adxRibbonTab1" visible="true" label="My Tab">
<group idQ="default:adxRibbonGroup1" [callbacks omitted]>
<button idQ="default:adxRibbonButton1" [callbacks omitted]/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
In the XML-code above, the add-in creates a shared tab, containing a private group, containing a button (private again).
Built-in and custom command bars in Ribboned Office 2007 applications
Do you know that all usual command bars that we used in earlier Office versions are still alive in Office 2007 applications supporting the Ribbon UI? For instance, our free Built-in Controls Scanner reports that Outlook 2007 e-mail inspector still has the Standard toolbar with the Send button on it. This may be useful if the functionality of your Office 2007 add-in takes into account the enabled / disabled state of this or that toolbar button.
As to custom toolbars, you can use set the UseForRibbon property of the corresponding component to true (the default value is false). This will result in your command bar controls showing up on the Add-ins tab along with command bar controls from other add-ins.
See also some tips about:
Note, If you didn't find the answer to your questions about MS Office 2007 Ribbon on this page, please see the HOWTOs section:
- VB .NET how to for Outlook, Excel, PowerPoint
- C# how to for Outlook, Excel, Word
- C++ how to for Outlook, Excel
Back to Add-in Express.NET homepage

