Chapter 25

Customizing the ribbon to run macros

In this chapter, you will:

  • Learn where to add ribbon code: the customui folder and file

  • Add controls to a ribbon

  • Understand the RELS file

  • Use images on buttons

  • Troubleshoot error messages

  • Learn other ways to run a macro

Unlike the command bars of old, a ribbon isn’t designed via VBA code. Instead, if you want to modify the ribbon and add your own tab, you need to modify the Excel file itself, which isn’t as impossible as it sounds. The new Excel file is actually a zipped file, containing various files and folders. All you need to do is unzip it, make your changes, and you’re done. Okay, it’s not that simple—a few more steps are involved—but it’s not impossible.

Before beginning, go to the File ...

Get Microsoft Excel VBA and Macros (Office 2021 and Microsoft 365) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.