VBA & Macro Problems

Identify Macros Assigned to Custom Excel Ribbon Controls

Natalie TaylorNatalie Taylor Nov 20, 2026 869 views

Question details

Identify the VBA macros associated with custom Excel Ribbon and Quick Access Toolbar controls without inspecting every macro individually.

Identify Macros Assigned to Custom Excel Ribbon Controls
Product
Microsoft Excel
Device & OS
not provided
Scenario
A workbook or Excel customization contains multiple custom controls whose assigned macros need to be identified.
Observed behavior
The user wants a mapping between each control and its assigned macro or callback.
Before you start

Determine whether the controls come from a workbook or add-in, or from your personal Excel Ribbon and Quick Access Toolbar customizations. Have the relevant workbook or add-in available, and note the control labels or IDs you want to investigate.

Solution 1Recommended

Inspect the workbook or add-in Ribbon XML

Use this method when custom controls are provided by a workbook or add-in that contains RibbonX XML.

RibbonX controls commonly use an onAction attribute to name the callback invoked when a control is clicked. The callback may call other procedures, so its name is not always the final macro that performs the work.

1
Open the file as a package

Open the workbook or add-in in an Office RibbonX editor. Alternatively, make a copy of an .xlsm or .xlam file, change the copy's extension to .zip, and open the ZIP archive.

2
Find the Ribbon XML

In the editor or archive, look for Ribbon XML files such as customUI/customUI.xml or customUI/customUI14.xml. If necessary, inspect the package relationships in _rels/.rels to locate the customization part.

3
Match controls to callbacks

Search the XML for the control's label or id, then check its onAction attribute. Record the control ID and callback name together.

4
Locate the VBA procedure

In Excel, press Alt+F11 to open the VBA editor, then use Edit > Find to search the project for the callback name. Inspect that procedure for any other macros it calls.

Inspect the workbook or add-in Ribbon XML
Some controls need further tracing: Built-in controls may use idMso rather than a custom onAction callback. A callback may also choose which macro to run at runtime; in that case, set a breakpoint in the callback and click the control to trace its execution.
Free Microsoft Office alternative

Work with Excel Spreadsheets in WPS Office

WPS Office is a free, lightweight Office alternative with a familiar interface and support for common Excel formats, making it easy to move everyday spreadsheet work. Use Microsoft Excel to inspect or troubleshoot Excel-specific Ribbon callbacks.

Open and edit spreadsheets in a familiar, easy-to-use interfaceCompatible with common Microsoft Excel formats, including XLSX and XLSReview spreadsheet data without relying on custom Excel Ribbon controlsMove everyday Office documents into a lightweight suite
microsoft office alternative - wps office

Frequently Asked Questions

Can I find a Ribbon control's macro without adding message boxes?

Yes. Inspect the workbook or add-in's Ribbon XML and look for the control's onAction attribute. For personal Excel customizations, export the settings from File > Options > Customize Ribbon and inspect the exported file.

What does the onAction attribute identify?

It typically names the callback invoked when the control is activated. Search for that name in the VBA editor using Edit > Find; the callback may then call another macro.

Why can't I find an onAction attribute for a control?

The control may be built in and identified by idMso, or it may be defined in a different workbook, add-in, or personal customization file. Check the relevant source and its XML.

How can I tell which macro a callback runs dynamically?

Open the callback in the VBA editor, click its margin to set a breakpoint, and activate the Ribbon control in Excel. Step through the code to see which procedure it calls.