Articles and Tutorials

Hiding a ToolBar

Author: Mike PalmatierPlatform: Visual Basic 6.0

To access the ToolBars via code, the CommandBars collection is used. The CommandBars collection is a collection of CommandBar objects. The
collection will contain a CommandBar object for each toolbar that is created. The collection is a "1" based collection and the first CommandBar in the collection will
always be the ActiveMenuBar, which is the menu displayed at the top of your application.
The second CommandBar in the collection will be the First ToolBar that was created,
the third CommandBar in the collection will be the Second ToolBar created, etc.

To hide a ToolBar, you simply use the index that corresponds with the ToolBar you want to hide to the CommandBars collection to access the Visible property of the
ToolBar and set it to False. This will only hide the ToolBar and not delete it.

The user can also hide a ToolBar when it is floating by clicking on the "close" button as shown in the picture below. The user can also hide or display ToolBars by
right-clicking on any toolbar. This will display a Context Menu that contains a list of all the ToolBars and allows them to be hidden or displayed. See the
Removing ToolBars from the Context Menu article for more details.