VBA & Macros

Customizing the Access Ribbon with XML

The Access ribbon can be customized with XML to add your own buttons, groups, and tabs — creating a professional, branded interface for your application.

M
MS Access Blog
3 min read
Customizing the Access Ribbon with XML

The Access ribbon is the primary interface for most users — and it can be completely customized for your application. You can add your own tabs with custom buttons that run macros or VBA procedures, hide built-in tabs that users do not need, and create a branded, professional interface that guides users to exactly the right tools.

How Ribbon Customization Works

Access ribbon customization uses RibbonX — an XML-based specification that defines the ribbon structure. You store the XML in a special system table (USysRibbons) and tell Access to use it via the database startup options.

The XML defines:

  • Custom tabs with your own labels
  • Groups within tabs
  • Buttons, dropdowns, checkboxes, and other controls
  • Callbacks to VBA procedures when controls are clicked

Setting Up the USysRibbons Table

  1. Enable system tables: File → Options → Current Database → Navigation Options → Show System Objects
  2. Create a new table named USysRibbons with these fields:
    • RibbonName (Short Text) — the name you will reference in startup options
    • RibbonXML (Long Text) — the XML definition

If the table already exists (it may in some databases), just add a new record.

Basic Ribbon XML Structure

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"
          onLoad="RibbonOnLoad">
  <ribbon startFromScratch="false">
    <tabs>
      <tab id="tabMyApp" label="My Application">
        <group id="grpDataEntry" label="Data Entry">
          <button id="btnCustomers" 
                  label="Customers" 
                  imageMso="ContactsFolder"
                  size="large"
                  onAction="OpenCustomers"/>
          <button id="btnOrders" 
                  label="New Order" 
                  imageMso="NewDocument"
                  size="large"
                  onAction="OpenNewOrder"/>
        </group>
        <group id="grpReports" label="Reports">
          <button id="btnMonthlyReport" 
                  label="Monthly Report" 
                  imageMso="ReportCenter"
                  size="large"
                  onAction="RunMonthlyReport"/>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Adding the XML to USysRibbons

  1. Open the USysRibbons table in Datasheet View
  2. Add a new record:
    • RibbonName: MyAppRibbon
    • RibbonXML: paste your XML

Connecting the Ribbon to Your Database

  1. Go to File → Options → Current Database
  2. In the Ribbon Name field, type the name you used in USysRibbons (e.g., MyAppRibbon)
  3. Click OK and reopen the database

Writing the VBA Callbacks

Each button's onAction attribute calls a VBA procedure. The procedure must accept a control As IRibbonControl parameter:

' In a standard module (not a form module):

Public Sub OpenCustomers(control As IRibbonControl)
    DoCmd.OpenForm "frmCustomers"
End Sub

Public Sub OpenNewOrder(control As IRibbonControl)
    DoCmd.OpenForm "frmOrders", , , , acFormAdd
End Sub

Public Sub RunMonthlyReport(control As IRibbonControl)
    DoCmd.OpenReport "rptMonthlySummary", acViewPreview
End Sub

The onLoad callback stores a reference to the ribbon object for later use:

Public gRibbon As IRibbonUI

Public Sub RibbonOnLoad(ribbon As IRibbonUI)
    Set gRibbon = ribbon
End Sub

Using Built-in Office Icons

The imageMso attribute uses built-in Office icon names. There are thousands available. Some useful ones for Access applications:

imageMsoDescription
ContactsFolderPerson/contacts icon
NewDocumentNew document
FileSaveSave
FileOpenOpen folder
ReportCenterReport/chart
DatabaseRefreshRefresh/sync
PrintPreviewPrint preview
ExportExcelExcel export
SendToMailEmail
FindMagnifying glass
RecordsAddNewAdd new record
RecordsDeleteDelete record

Search "Office imageMso list" online for a complete reference with previews.

Hiding Built-in Tabs

To hide built-in tabs (like the Home, Create, External Data tabs) that users should not access:

<ribbon startFromScratch="false">
  <tabs>
    <!-- Hide built-in tabs -->
    <tab idMso="TabHomeAccess" visible="false"/>
    <tab idMso="TabCreate" visible="false"/>
    <tab idMso="TabExternalData" visible="false"/>
    <tab idMso="TabDatabaseTools" visible="false"/>
    
    <!-- Your custom tab -->
    <tab id="tabMyApp" label="My Application">
      ...
    </tab>
  </tabs>
</ribbon>

Dynamic Ribbon Controls

You can show/hide or enable/disable ribbon controls dynamically using callbacks:

<button id="btnAdminTools" 
        label="Admin Tools" 
        imageMso="SecuritySettings"
        getVisible="GetAdminVisible"
        onAction="OpenAdminTools"/>
Public Sub GetAdminVisible(control As IRibbonControl, ByRef visible As Variant)
    visible = (CurrentUser() = "Admin")
End Sub

' After login, refresh the ribbon:
gRibbon.Invalidate  ' Forces all callbacks to re-evaluate

Conclusion

Ribbon customization transforms Access from a developer's tool into a polished application with a branded, purpose-built interface. A custom tab with clearly labeled buttons for your application's key functions — combined with hidden built-in tabs — gives users exactly what they need and nothing they do not. The XML is straightforward once you understand the structure, and the VBA callbacks give you full control over what each button does.

Explore Topics

#ribbon#customization#xml#vba#application design
M

Written by

MS Access Blog

Content creator and writer sharing insights and stories.