Visual Basic Concepts
As explained earlier, a toolbar is simply another form of command bar object. So to convert our example add-in from appearing as a menu entry to appearing as a button on a toolbar, make the following code changes:
' This line puts a command bar as a button on the
' toolbar before the 20th item, in this case, the
' form coordinates box.
Set mcbMenuCommandBarCtrl = _
VBInst.CommandBars("Standard").Controls.Add(1, , , 20)
If you want to put the add-in on the Add-In toolbar rather than the Standard toolbar, first activate the Add-In toolbar in the Add-In Manager, then change the reference name of the CommandBar object. The following code adds a button in the first position (leftmost side) of the Add-In toolbar.
' This line puts a command bar as a button on the
' Add-in toolbar.
Set mcbMenuCommandBarCtrl = _
VBInst.CommandBars("Add-Ins").Controls.Add(1)