Deleting a Custom Toolbar

If you create a toolbar and decide that you don't want to keep it, you can get rid of it without closing the Excel application. Simply use the Delete method. For example, to delete the Budget Plans toolbar you can enter the following statement in the Immediate window:

CommandBars("Budget Plans").Delete

Note: You cannot delete built-in toolbars. Using the CommandBar Properties

The CommandBar object has a number of properties. You'll work with some of them in the Immediate window.

1. Use the Immediate window to create a new toolbar named "My Reports":

set myBar= CommandBars.Add("My Reports", msoBarBottom, False)

2. To find out whether a specific toolbar is built-in, use the statement: ?CommandBars("My Reports").BuiltIn

3. To determine the index number of the new toolbar in the CommandBars collection, enter the following statement:

?CommandBars("My Reports").Index

The toolbar is displayed on the screen when its Visible property is set to True. Set the Visible property to False to hide the command bar.

0 0

Post a comment