CommandBars Articles and Tutorials

Adding a ToolBar

Author: Mike Palmatier
Platform: Visual Basic 6.0

The CommandBars.Add method is used to add a blank toolbar. The method accepts both a name and toolbar position for the toolbar. The name given to the toolbar is seen when customizing toolbars. It is recommended that you name the toolbar to a meaningful name that summarizes what type of tasks the group of buttons on the toolbar perform. The toolbar position indication where the toolbar will be located when it is added, available locations are stored in the XTPBarPosition enumeration. Locations the toolbar can be placed include the top, bottom, left, and right side of your application. The toolbar can also start out floating.

The picture below illustrates a blank toolbar.

Blank Toolbar

The code below illustrates how to add a blank toolbar to the top of your application.

Dim ToolBar As CommandBar
Set ToolBar = CommandBars.Add("Standard", xtpBarTop)