Saving a Custom Ribbon

Because you'll probably want to test your custom ribbon as you build it, let's start by talking about how to use ribbon customizations in Access. The primary way to use a custom ribbon is with a special table named USysRibbons. This section explains how you can create this table.

Access loads ribbon customizations from a USysRibbons table, which contains the fields shown in the table that follows:

Field Name Data Type


RibbonName TEXT

Contains the name of a Ribbon that you use in your application. You can specify the name of a Ribbon for a form, report, or database.

RibbonXml MEMO

Contains the XML definition for the ribbon customization.

Alternatively, you can create this table using the following SQL statement in a DDL query:


RibbonName TEXT (255) PRIMARY KEY, RibbonXml MEMO


You can also create application-level Ribbons using a COM Add-in. Appendix C provides more information about writing a COM Add-in to customize the Ribbon.

To define multiple Ribbons in your application, simply add a new record to the USysRibbons table.

There is yet another way to create the USysRibbons table for use in your databases: by creating a database called Blank12.accdb. When you create a new blank database in Access 2007, Access first looks for a file named Blank12.accdb in the Office\Templates directory. If it finds one, it creates a copy of the file for your new Blank Database. If this file contains a USyRibbons table, your new database automatically includes the table.

The USysRibbons table should be local to the database you are customizing. Ribbon customizations are not loaded if the USysRibbons table is linked in another database.

0 0

Post a comment