VBA & Macro Problems

How to Get the Active Microsoft Access Ribbon Name Using VBA

Amos GikundaAmos Gikunda Nov 4, 2026 868 views

Question details

The user needs a way to identify the currently active custom ribbon in Microsoft Access using VBA to dynamically hide or show graphics based on the selected ribbon.

Product
Microsoft Access
Device & OS
not provided
Scenario
Managing an Access database with multiple custom ribbons and needing to programmatically check which ribbon is actively displayed.
Observed behavior
The user wants to retrieve the name of the application's selected ribbon or the ribbon assigned to specific forms/reports.
Before you start

Ensure that your Microsoft Access database has custom ribbons defined in the USysRibbons table and that you have enabled macro and VBA execution in the Trust Center.

Solution 1Recommended

Retrieve the Application-Level Custom Ribbon ID

Use the CurrentDb properties to fetch the name of the custom ribbon that is globally assigned to the Microsoft Access application.

This approach reads the database properties directly to find the application-wide ribbon name. It is ideal when you have a primary custom ribbon set for the startup of the database.

1
Open the VBA Editor

Press ALT + F11 in Microsoft Access to open the Visual Basic for Applications (VBA) editor.

2
Insert the retrieval code

In your desired module or event procedure, enter the following code: MsgBox CurrentDb.Properties("customribbonid")

3
Execute the code

Run the macro or trigger the event to display a message box containing the name of the active application-level ribbon.

Retrieve the Application-Level Custom Ribbon ID
Error Handling Recommendation: If an application-level custom ribbon has not been set, the 'customribbonid' property may not exist in the collection, which will cause a run-time error. Always wrap this call in a VBA error handling block (e.g., On Error Resume Next).
Free Microsoft Office alternative

Try WPS Office for Your Spreadsheet and Document Needs

While Microsoft Access is a specialized database tool, WPS Office provides a lightweight, comprehensive, and free alternative for your daily Word, Excel, and PowerPoint tasks. It supports VBA macros in spreadsheets and offers seamless Microsoft Office format compatibility.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package.
  2. 2. Install the software: Run the installer and follow the on-screen prompts to set up WPS Office on your computer.
  3. 3. Open your files: Easily open your exported Access data or existing Excel workbooks directly in WPS Spreadsheets to continue your data analysis.
Fully compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formatsSupports advanced spreadsheet functions and VBA macros in WPS SpreadsheetsLightweight application that uses minimal system resourcesFamiliar tabbed user interface for a zero-learning-curve transition
microsoft office alternative - wps office

Frequently Asked Questions

Why do I get a 'Property not found' error when calling CurrentDb.Properties("customribbonid")?

This error occurs because the 'customribbonid' property is only appended to the CurrentDb.Properties collection after a custom ribbon has been explicitly set in the Access Options (Current Database -> Ribbon Name). If it's left blank, the property does not exist.

Can I dynamically change the active Access ribbon using VBA after startup?

You cannot change the main application ribbon directly via VBA once the database is running. However, you can load ribbons using Application.LoadCustomUI and dynamically assign them to specific forms by changing the form's RibbonName property before it is opened.

How do I assign a custom ribbon to a specific form without using VBA?

Open the form in Design View, press F4 to open the Property Sheet, click on the 'Other' tab, and type the exact name of your loaded custom ribbon into the 'Ribbon Name' property field.