17 Working with the Ribbon

In This Chapter

  • Looking at the Excel Ribbon UI from a user’s perspective
  • Using VBA to work with the Ribbon
  • Customizing the Ribbon with RibbonX code
  • Looking at examples of workbooks that modify the Ribbon
  • Using boilerplate code for creating an old-style toolbar

Ribbon Basics

Beginning with Microsoft Office 2007, the primary user interface was changed from menus and toolbars to the Ribbon. While there are similarities between toolbars and the Ribbon, the Ribbon is radically different, particularly when it comes to VBA.

The Ribbon is made up of a hierarchy of tabs, groups, and controls. The tabs appear across the top. Each tab consists of one or more groups and each group consists of one or more controls.

  • Tabs: The top object in the Ribbon hierarchy. You use tabs to separate the most fundamental operations into logical groups. The default Ribbon contains the Home, Insert, Page Layout, Formulas, Data, Review, and View tabs. You can add controls to existing tabs or create new tabs. For example, you might make a new tab with your company’s name that contains controls for code that’s specific to your company’s operations.
  • Groups: The second highest object in the Ribbon hierarchy. Groups contain any of the number of different types of controls and are used to logically separate operations supported by a Ribbon tab. The default Formulas tab contains the Function Library, Defined Names, Formula Auditing, and Calculation groups. You don’t have include ...

Get Excel 2016 Power Programming with VBA 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.