How to Add Custom Icons to Excel RibbonX Macro Buttons
Question details
The user wants to replace the limited built-in Excel ribbon icons by adding custom images to their macro buttons using RibbonX XML.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Customizing the Excel Ribbon interface to display personalized icons for user-created macro buttons.
- Observed behavior
- Excel's default interface only offers a restricted set of built-in icons for custom Ribbon tabs and groups, requiring external XML modification tools to embed and map custom images.
Ensure you have the Office RibbonX Editor or Custom UI Editor installed on your computer. Prepare your custom icon as a small image file (such as a 32x32 PNG with transparency) before modifying the XML.
Add Custom Icons Using the Office RibbonX Editor
Use the Office RibbonX Editor to embed custom images into your workbook and map them to your macro buttons using a customUI XML script.
Because Excel does not natively allow importing custom images for macros through its standard options menu, you must modify the workbook's underlying XML structure.
The Office RibbonX Editor is a free, specialized tool designed specifically to safely inject XML code and embed images into Microsoft Office files.
Save and completely close your workbook in Excel. Open the Office RibbonX Editor, click 'File' > 'Open', and select your Excel file.
Click the 'Insert' menu at the top and select 'Icons'. Browse your computer to find your prepared image file and insert it. Note the Image ID assigned in the left pane (e.g., 'picImage').
If you don't already have a customUI part, click 'Insert' > 'Office 2010+ Custom UI Part'. In the text editor pane, define your button and set the image attribute to your image ID. For example: <button id="btnBTN" label="My Label" image="picImage" onAction="macroMacro" size="normal" />
Click the 'Validate' button on the toolbar to ensure your XML code has no syntax errors. Once validated, click 'Save' and close the RibbonX Editor.
Reopen your workbook in Excel. Navigate to your custom Ribbon tab to verify that the macro button is now displaying your custom icon.

Try WPS Office for Your Spreadsheet Needs
If modifying XML files and using third-party Ribbon editors feels overly complex, consider switching to WPS Office. It is a highly capable and user-friendly office suite that natively supports advanced spreadsheet functions and macros while maintaining full compatibility with Microsoft Excel formats.
- 1. Download the software: Visit the official WPS website and download the free WPS Office installer.
- 2. Install WPS Office: Run the installer and follow the quick setup wizard to install the suite on your computer.
- 3. Open your spreadsheets: Launch WPS Spreadsheet and seamlessly open your existing Excel workbooks and macro-enabled files.

Frequently Asked Questions
What image formats are best for custom Ribbon icons?
PNG is the most recommended format for custom Ribbon icons because it supports transparency, ensuring the icon blends perfectly with the Ribbon background. BMP and JPEG files are also supported but lack native transparency.
Why is my custom macro button not appearing on the Excel Ribbon?
This is typically caused by XML syntax errors, incorrect casing in your XML tags, or forgetting to add the correct 'onAction' macro reference. Use the 'Validate' feature in the RibbonX Editor to check your code for formatting mistakes.
Can I use built-in Excel icons instead of uploading a custom image?
Yes. If you prefer to use one of Excel's built-in icons, you can use the 'imageMso' attribute instead of the 'image' attribute in your XML code (e.g., imageMso="FileSave"). This pulls the icon directly from Microsoft's internal icon library.




