Microsoft Office Development and Consultancy
|VBA > Toolbars & Menus > CommandBars||< Previous | Next >|
What is a CommandBar ?
The commandbar is a generic term that includes menu bars, toolbars and shortcut menus.
Creating a new CommandBar
You create a new command bar using the Add method from the CommandBars collection:
This is the same in Excel, Word and PowerPoint.
Name - The name of the new command bar. If omitted a default name is assigned to the command bar (such as Custom 1).
Position - The position or type of the new command bar.
MenuBar - The default value is False. True to replace the active menu bar with the new command bar.
Temporary - The default value is False. True to make the new command bar temporary. Temporary command bars are deleted when the container application is closed.
Preventing a Toolbar from being modified
The Protection constants are additive which means you can apply several to the same commandbar.
The following means the toolbar cannot be customised or moved.
Creating a new commandbar
Dim objCommandBar As CommandBar
Deleting a CommandBar
DIsablying a CommandBar
CommandBars("MyToolbar").Enabled = False
This effectively removs it from view and also from the Customise dialog box list of toolbars
Is there a quick way to disable the controls on a toolbar ??
|© Better Solutions Limited 20-Feb-2014||< Previous | Top | Next >|