In this blog post we look at how you can use your own icon or image for the button of your macro on the Ribbon. This could be an image that you have created, or one that you downloaded from a website.
By using our own icons we can create customised workbooks and not be constrained by the standard Microsoft icon set provided.
In this example I have a macro that exports all the worksheets of a workbook to PDF, and I want to assign it to the icon shown below. This icon was downloaded from flaticon.com, a fantastic resource for icons that you can use for your macros.
- Bootstrap Studio is a powerful desktop app for designing and prototyping websites. It comes with a large number of built-in components, which you can drag and drop to assemble responsive web pages.
- The best video editor overall is: Adobe Premiere Pro For a small monthly sub, Premiere Pro offers outstanding value for money. It's the industry-standard video editing program, used by the pros.
3: Open Book1.xlsm in the Office RibbonX Editor 4: Right click on the File name in the Office RibbonX Editor or use the Insert menu 5: Choose 'Office 2007 Custom UI Part' to create the customUI.xml file 6: Paste the RibbonX below in the right window Note: If there is no customUI14.xml file it will load the customUI.xml also in Excel 2010 and up.
Custom Ui Editor For Mac Windows 7
Download the Custom UI Editor for Office
To insert our icon into a Ribbon of an Excel file we need the Custom UI Editor for Office. This is free to download and if you do not have it already you can download it here – Custom UI Editor for Office.
Adding your Own Icon to the Ribbon for your Macro
Open the Custom UI Editor and open the Excel workbook where you would like to add your icon.
You may see some XML code appear as soon as you open the file, but you will probably need to insert some sample XML code to get started.
You can do this by clicking Insert, Sample XML and then Custom Tab.
This code can now be edited to work for you. Change the label for the tab, group and then button to what you want to use.
Then enter the name of the image you want to use for the image argument. In the example below my image is saved as analytics-72. Shortly we will insert this into the Excel workbook.
Finally enter the name of your macro for the onAction argument. My macro is called ExportAsPDF.
You can copy and paste the relevant lines of code to easily add more buttons, groups or tabs.
Insert your Image to the Workbook
With the code now set to add your icon to the Ribbon and run your macro, we need to insert the image into the workbook so that it is there to be used.
Click the Insert menu and then Icons. Browse and select your icon and it will be added to the file. You can see it on the left. Click the + sign next to the workbook name to expand the list of all added icons.