You can use the Office RibbonX Editor to embed custom icons to ribbon. Custom UI supported ico, bmp, png, jpg and gif icons, but the best graphic format to use for custom icons is PNG (portable network graphics) as it supports an alpha channel and results in small file sizes. Icons can be any size, although the following sizes are recommended: 16x16, 32x32 pixels.
Create your custom icon
- Open Microsoft Paint.
- Resize the picture to 32x32 pixels.
- Create your icon and save it with the filename "
custom-icon.png". The filename is the unique ID of the icon.
Add your custom icon
- Launch the Office RibbonX Editor.
- Open your workbook by clicking the Open button on the Office RibbonX Editor toolbar and navigating to the file.
- From the Insert menu, choose Office 2010+ Custom UI Part. This will add a
customUI14.xmlentry under your workbook in the tree view on the left.
- From the Insert menu, choose Icons.
- Browse and open your "
- Your icon file has been added under the "
Add the ribbon XML
- Copy and paste xml code below into customUI14.xml window.
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon startFromScratch="true"> <tabs> <tab id="customTab" label="Custom Tab"> <group id="customGroup" label="Custom Group"> <button id="customButton" label="Custom Button" image="custom-icon" size="large" onAction="Callback"/> </group> </tab> </tabs> </ribbon> </customUI>
- Choose File > Save and then choose File > Close.
- Open the workbook and you will see the custom icon under the Custom Group.