Monday, May 12, 2008

How Custom Access 2007 Ribbons Work

The most challenging issue for Access users and developers when upgrading to Access 2007 is the radical shift from CommandBars to the RibbonBar paradigm.

In this outline I will introduce the operation of the Ribbon in Access 2007, provide some guidance on customisation, and point you to various tools and on-line resources to assist your efforts at Ribbon customization.

Getting Started:
  1. Download and install my Access Ribbon Switchboard Database demo database.

  2. Start Access 2007. Open the Access Ribbon Switchboard Database using the {SHIFT} key.

  3. Click the Microsoft Office Button, click Access Options, and then click the Advanced tab.

  4. In the General section, select the option Show add-in user interface errors, when debugging a RibbonBar.

  5. Click OK to close the Access Options dialog box.

  6. Right-click the Navigation pane. Point to Navigation Options, and then click Show System Objects. Click OK.

    Note: The Access system tables appear in the Navigation
    pane. In the Demo Database the system table, USysRibbons,
    each record contains the XML for each custom Ribbon in the

  7. Click the Microsoft Office Button, and then click Access Options.

  8. Click the Current Database tab, in the Navigation Pane and Ribbon and Toolbar Options sections, you will see that the following option settings hide the Database Window, the Navigation Pane, and the Full Menus, and set the custom ribbon, Main, as the StartUp Ribbon Bar:

  9. Click OK to close the Access Options dialog.

  10. Close the Demo Database.
  11. Re-open the Demo Database without using the {SHIFT} key.

  12. The Ribbon UI displays the Main Ribbon Custom Tab:

    Note: You use a Ribbon from the USysRibbons table to
    supply the UI for a specific form or report by setting the RibbonName
    property to the name of the Ribbon record in USysRibbons table.

Creating the XML Ribbon Definitions:

The ribbon definition is a simple XML file and can be easily created in any text editor, but if you use the free Microsoft Visual Web Developer 2005 Express Edition (VWD), you can get IntelliSense for your code. You can point it at the custom ribbon schema at and VWD should pick up the correct file, which is called customUI.xsd. You can download the file from This enables VWD to provide type-ahead IntelliSense for correct ribbon xml:

The contents of the XML file are:
  1. customUI - this is the top level element for a custom ribbon.

  2. ribbon - defines the ribbon itself. Set the startFromScratch attribute = "true" to create a new blank ribbon. If this attribute is omitted or left blank, the custom ribbon will merge with the existing Access ribbons.

  3. tab - creates a new tab in the ribbon

  4. group - creates a group. These are used to logically group controls in the ribbon.

  5. id - unique name of a control in the ribbon label - static text displayed with a control

  6. button - similar to a command button. Use the onAction attribute to specify the name of a macro in the Ribbon macro in the Demo database which will be called when the button is clicked.

  7. dropDown - creates a dropdown list that cannot be updated. To create a drop down that the user can type in, use a comboBox control instead.

  8. imageMSO - specifies the name of a built-in image control in Office 2007 that can be used as in icon in your ribbon. You can find the Image name or ControlID by hovering your mouse over a control image in the Customize the Quick Access Toolbar dialog, and reading the screentip for the control image. For example, the ControlID for the Form icon image is CreateForm:

Reviewing the Ribbon XML:

On I provide for free download two tools that will help you to debug the XML for your custom ribbon bars:

These freeware tools providing advanced Office 2007 Ribbon XML file review features. Open any Office 2007 Ribbon XML file in the XML File Reviewer to review an Office Ribbon's full menu hierarchy in a tree-view with all control attributes detailed in an adjacent panel. The Access 2007 USysRibbons Add-In reviews and previews the custom Ribbons in the USysRibbons table of an Access 2007 database. Extensive reference resources are incorporated into the GUI's of both products. Both tools require Access 2007.

Update 9 June 2008: Check out the Office 2007 RibbonCreator WYSYWIG tool from

More Information: