Create New Toolbars

To create a new toolbar, use the Add method to add a new Toolbar object to the Toolbars collection.

The Add method requires as input the name of the toolbar to add. The name is a string of alphanumeric characters with no punctuation other than a dash (-) or an underscore (_). The name is the easiest way of identifying the toolbar within the collection.

You can change the name of a toolbar once it has been created. To change the name of an existing toolbar, use the Name property for that toolbar.

Create a new toolbar

This example creates a new toolbar called “TestToolbar” in the first menu group in the MenuGroups collection.

Sub Ch6_CreateToolbar()
	Dim currMenuGroup As AcadMenuGroup
	Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)

	' Create the new toolbar
	Dim newToolbar As AcadToolbar
	Set newToolbar = currMenuGroup.Toolbars.Add("TestToolbar")
End Sub