Article ID: 162814 - Last Review: January 19, 2007 - Revision: 4.2 Sample macros to return ID for a CommandBar controlThis article was previously published under Q162814 On This PageSUMMARY The Id property for the CommandBar object uses a unique
number for each built-in menu bar, shortcut menu bar, submenu, menu item, or
toolbar. The Id is often required when you reference a control on a command
bar. The Visual Basic for Applications macro examples in this article return
the Id for various Commandbar controls. MORE INFORMATION
For additional information, click the following article number to view the
article in the Microsoft Knowledge Base: 159466
(http://support.microsoft.com/kb/159466/
)
XL97: List of ID numbers for built-in command bar controls
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Menu on a Menu BarThe following macro example returns the Id for the Tools menu of the built- in Chart menu bar:Menu Command on a MenuThe following macro example returns the Id for the Exit command on the File menu of the built-in Worksheet menu bar:Command on a SubMenu of a ShortCut MenuThe following macro example returns the Id for the Calculated Item command on the Formulas submenu of the PivotTable shortcut menu bar:REFERENCES For more information about programmatically customizing
command bars, in the Visual Basic Editor, click the Office
Assistant, type Customizing menus, click
Search, and then click to view "Overview of Command Bars."
Note If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Visual Basic Help is not installed on your computer, see the following article in the Microsoft Knowledge Base: 120802
(http://support.microsoft.com/kb/120802/
)
Office: How to add/remove a single Office program or component
| Article Translations
|
Back to the top
