Identify Macros Assigned to Custom Excel Ribbon Controls
Question details
Identify the VBA macros associated with custom Excel Ribbon and Quick Access Toolbar controls without inspecting every macro individually.

- 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.
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.
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.
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.
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.
Search the XML for the control's label or id, then check its onAction attribute. Record the control ID and callback name together.
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.

Export personal Ribbon and Quick Access Toolbar customizations
Use this method for controls added through Excel's customization options rather than through a workbook's RibbonX XML.
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.

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.




