Share via


Manipulating Command Bars and Command Bar Controls with VBA Code

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The command bars object model exposes a wealth of objects, collections, properties, and methods that you can use to show, hide, and modify existing command bars and command bar controls, and create new ones. You can also specify a VBA procedure to run when a user clicks a command bar button or to respond to events triggered by a command bar or command bar control. The following sections provide a broad overview of the kinds of things you can do in your custom Office solutions and how to accomplish them.

Note   Many of the examples in this section refer to the "Menu Bar" CommandBar object. This is the name of the main menu bar in Word, PowerPoint, and Access. The main menu bar in Excel is called "Worksheet Menu Bar." To experiment with sample code that refers to the "Menu Bar" CommandBar object in Excel, simply change the reference from "Menu Bar" to "Worksheet Menu Bar."