Skip to content

Customising the Word 2007 and 2010 ribbon with the Office Custom UI Editor – a summary and a couple of tips

A quick summary of how to use the Office Custom UI Editor and a couple of tips to make life easier.

There are three main ways to add custom tabs and menus to the ribbon: manually in the Word Options (though this is rather limited for Word 2007); with VBA or Visual Studio code; or by adding a custom UI section to the Word template (or document) and then editing it’s XML with the Custom UI Editor.

This blog is about the third way – the Custom UI Editor. You don’t need to understand much about XML to use it (the patterns in the XML are pretty easy to follow) but there are a couple of things that I would have loved to have known about before I started – the gallery of icons, and the tendency of the new version to insert the 2010 schema instead of the 2007 one.

The following is a quick summary. Detailed examples can be found at some of the links at the end.

What you need

  1. The Office Custom UI Editor, OfficeCustomUIEditorSetup.MSI, which you can download from http://openxmldeveloper.org/archive/2009/08/07/7293.aspx
  2. Choosing what your button should look like is made easy if you select from the 100s of buttons built into Office. You can preview these and get the name to use in your menu with the following:
    1. For Office 2010 download Office2010IconsGallery.docx from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2d3a18a2-2e75-4e43-8579-d543c19d0eed
    2. For Office 2007 download Office2007IconsGallery.EXE from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=12B99325-93E8-4ED4-8385-74D0F7661318

Creating tabs and custom menus

  1. Create your document, either a macro enabled template (dotm) or macro enabled document (docm), and save it.
  2. Run the Custom UI Editor and open the document.
  3. Insert a Custom UI part for Office 2007 or 2010 as appropriate. For Office 2007 this will be called “CustomUI.xml” while for Office 2010 it will be called CustomUI14.xml.
  4. There are a number of sample items you can insert. Try one that appeals, eg Custom Tab, save it, and open your document to view what it does.
    1. Tip: the current version of the Custom UI Editor will insert an XML fragment for Office 2010, so if you add it to a 2007 document the custom tab won’t appear. The problem is in the first line which references the Office 2010 schema
      customui xmlns=”http://schemas.microsoft.com/office/2009/07/customui”
      What you need to do for office 2007 is change the numbers to read
      customui xmlns=”http://schemas.microsoft.com/office/2006/01/customu”
      That’s all.
    2. Note also that when you build up your own menu inserting one from the Insert menu of the Custom UI Editor will overwrite what’s there.

Editing the XML for a button

In the XML that the Custom UI Editor inserts, buttons are defined like this:

  • onaction=”AutoSaveOptions”
    size=”large”
    imagemso=”SaveAndCloseConflictView”
    label=”AutoSave Options”
    id=”btnAutoSaveOptions”
  • id: a unique name (id) for the button
  • label: this is the text by or under the button in the ribbon
  • imageMSO: this is the name of the icon (button) in the gallery document
  • size: there are only two possible values – “large” and “normal” – “large” is a full size button and “normal” is small. Several “normal” size buttons together will be stacked in a column
  • onAction: this is the VBA macro that will be called by clicking on the button. It needs to be defined like this in your code:
    • Private Sub AutoSaveOptions(control As IRibbonControl)
      frmRemindOptions.Show
      End Sub
    • Note that the VBA for the menu could call anything – some other VBA, or some exposed method in an add-in.

More information

The following links contain more information about using the Custom UI Editor and menu creation in general.

Leave a Comment





This site uses Akismet to reduce spam. Learn how your comment data is processed.