For many people out there, who have written AddIns for Excel using VB6, they find themselves with a dilemma: how do I add my custom toolbar to another Ribbon tab?
Well, I honestly do not have an answer to that question; however, we can still customize the Ribbon and move this Custom Toolbar to another location. To be specific, we can move it to the QAT (Quick Access Toolbar).
First off, you need to add your custom toolbar. You can use VBA to add this custom toolbar as follows:
Dim cmdBar As CommandBar
Dim btn As CommandBarButton
On Error Resume Next
cmdBar = Application.CommandBars.Add
cmdBar.Name = "Testing"
cmdBar.Visible = True
btn = cmdBar.Controls.Add(Type:=msoControlButton)
.Style = msoButtonIconAndCaption
.FaceId = 986
.Caption = "Robert Martim"
The above code will add the following to the Add-Ins tab:
Now, you create your other Excel document where you wish to add the GroupAddInsCustomToolbars to it. Open this Excel document using the custom UI Editor where the following XML must be inserted:
<mso:control idQ="mso:GroupAddInsCustomToolbars" visible="true"/>
The GroupAddInsCustomToolbars is placed under the mso namespace; therefore we must refer to it and then get the idQ for it. Remember that GroupAddInsCustomToolbars is not a group per se, but a control (it is a commandbar control). Hence, if you try to place it under a tab, it fails since it cannot find the group.
Also, remember that to customize the QAT you must start from scratch. The final result is: