Chapter 29: Customizing Access Ribbons
1035
Line 7 begins the definition of the first group on tab1 and line 9 ends this group. Within the
group are the controls displayed by the group.
The rest of this prototype ribbon is simple repetition of the first few items.
Note
Remember: XML is case-sensitive. Be careful to use exactly the same case and spelling for all references in your
XML as well as in the callback code driving the ribbon.
Adding Ribbon Controls
The previous section presented a simple prototype ribbon. In this example, the controls were indi-
cated by ... Controls go here .... on lines 8 and 13. Take a moment and look at the actual
XML construction of a few common ribbon controls.
Specifying imageMso
Most, but not all, ribbon controls include an imageMso attribute that specifies the picture
attached to the control. You are not able to provide simple references to image files; instead, you
must use an imageMso identifier for this purpose. Every ribbon control in the Office 2010 appli-
cations has an associated imageMso value. You use these values on your custom Access ribbon
controls and provide a label that tells your users the exact purpose of the control.
There are two ways to obtain the imageMso for a particular ribbon control. The first method is
with the ribbon designer described earlier in this chapter. Use the Customize the Ribbon window
to open a particular ribbon, use the drop-down in the upper left of the designer to select the rib-
bon category containing the ribbon command, and hover the mouse over the command’s entry in
the list (see Figure 29.21).
The imageMso for the Find command (FindDialog) is shown in parentheses in the ToolTip
that appears near the selected command.
The second way to discover imageMso values is with the imageMso_Galleries.accdb exam-
ple database on this book’s CD. The ribbon in this database includes every Office ribbon icon,
arranged as a number of Gallery ribbon controls (see Figure 29.22). Hovering the mouse over an
icon in a Gallery shows the icon’s imageMso. The ribbon Galleries in imageMso_Galleries.
accdb are divided among 6 different ribbons, each containing 5 or 6 galleries, each with 100
icons. The Office application family has so many icons that they could not all fit on a single ribbon.
When looking up an icon’s imageMso, be sure to check the other ribbon Galleries. imageMso_
Galleries.accdb includes a form (frmSelectRibbonGallery) that dynamically adds a
ribbon icon Gallery to the main as you select a button.