Customizing Office Ribbon UI:
custom button, group, tab in Outlook, Excel, Word

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

Add-in Express Home > Add-in Express for Office and .NET > Online Guide > Tips and notes > Ribbon HOWTOs

Office Ribbon HOWTOs

How to find the Id of a built-in Ribbon control

Open the Customize the Ribbon tab in the File | Options dialog, hover the mouse cursor over a list item that represents a Ribbon control and pay attention to the tooltip. In the screenshot below, the control caption is Bullets, the control's Id is BulletsGalleryWord.

The Id of the Bullets control is BulletsGalleryWord

You can find other details in a list of built-in Ribbon controls, see Referring to Built-in Ribbon Controls.

How to create a custom Ribbon tab

Open the designer of the add-in module.

Click the ADXRibbonTab command in the toolbar at the top of the module (see the screenshot below).

Click the ADXRibbonTab command on the Add-in Express Toolbox

Select the newly created component and configure it using the Properties window.

How to create a custom Ribbon group on a custom or built-in tab

Open the designer of the add-in module.

Put a new ADXRibbonTab component onto the add-in module or select an existing one.

To customize a built-in tab, set the IdMso property of the tab component, see Referring to Built-in Ribbon Controls.

In the in-place editor, use the toolbar to add a Ribbon group component (ADXRibbonGroup) to the tab (see the screenshot below).

Adding a Ribbon group to a Ribbon tab

Select the newly created component and configure it using the Properties window.

How to create a custom Ribbon button

Open the designer of the add-in module.

Put a new ADXRibbonTab component onto the add-in module or select an existing one.

In the in-place editor, select an existing Ribbon group component (ADXRibbonGroup) or create a new one.

In the in-place editor, use the toolbar to add a Ribbon button component (ADXRibbonButton) to the group (see the screenshot below).

Creating a Ribbon button on a Ribbon group

Select the newly created component and configure it using the Properties window.

How to add a built-in Ribbon button to a custom group

Add an ADXRibbonButton component to an ADXRibbonGroup.

Specify the Id of the built-in Ribbon button in the ADXRibbonButton.IdMso property.

How to select a Ribbon component without using the in-place designer

In the Properties window, select the required component using the dropdown demonstrated in the screenshot below.

Use the Properties window to select a Ribbon component

How to position a custom Ribbon tab/group among built-in tabs/groups

Open the designer of the add-in module.

Select the corresponding Ribbon component and specify the Id of the preceding (following) built-in tab/group in the InsertAfterIdMso (InsertBeforeIdMso) property.

How to intercept or disable a built-in Ribbon control

Open the designer of the add-in module.

Select an ADXRibbonCommand component existing on the add-in module or create a new one using the ADXRibbonCommand command in the toolbar at the top of the module (see the screenshot below).

Create an ADXRibbonCommand component

Switch to the Properties window and specify the Id of the built-in Ribbon button you want to disable or intercept in the IdMso property of the ADXRibbonCommand component.

In the Properties window, choose the appropriate value of the ActionTarget property; for a control type producing no events (e.g. gallery or menu) choose NonActionControl.

To intercept the control's event, in the Properties window switch to the Events tab and add an event handler to the OnAction event. In the event handler, add custom code. In particular, you can set e.Cancel=true to cancel the action associated with the Ribbon control. Note that if you set ActionTarget=NonActionControl, the event handler is ignored.

To disable the built-in ribbon control, in the Properties window set ADXRibbonCommand.Enabled=false.

How to hide a built-in Ribbon tab

Open the designer of the add-in module.

Put a new ADXRibbonTab component onto the add-in module or select an existing one.

In the Properties window, specify the Id of the built-in tab to be hidden in the ADXRibbonTab.IdMso property.

To hide the built-in tab, set the ADXRibbonTab.Visible property to False.

How to hide a built-in Ribbon group

Open the designer of the add-in module.

Put a new ADXRibbonTab component onto the add-in module or select an existing one.

In the Properties window, set the ADXRibbonTab.IdMso property to the Id of the built-in tab.

In the in-place editor, select an existing Ribbon group component or add a new one.

In the Properties window set the ADXRibbonGroup.IdMso property to the Id of the built-in group.

To hide the built-in group, set the ADXRibbonGroup.Visible property to False. Note, this doesn't hide the built-in group added to the Quick Access Toolbar (QAT).

How to activate a custom ribbon tab

To activate a Ribbon tab, call ADXRibbonTab.Activate() at run-time. Note this doesn't work in Office 2007 because it doesn't support that Ribbon API call.