How would I programatically add a "divider" to a custom toolbar in Excel ?
Thanks
Printable View
How would I programatically add a "divider" to a custom toolbar in Excel ?
Thanks
You can add a separator in a toolbar the same way you add one for a menu in
Excel. Use the .BeginGroup = True of the Toolbar object you already have
setup. It will place a divider before the next button or control your adding.
VB Code:
'This will create a new toolbar and create two buttons with a divider between them. Public Function Test() Dim oCB As Office.CommandBar Dim oCBB As Office.CommandBarButton Set oCB = Excel.CommandBars.Add("Test", , , True) oCB.Visible = True Set oCBB = oCB.Controls.Add(1, , , , True) oCBB.BeginGroup = False oCBB.Caption = "Test1" Set oCBB = Nothing Set oCBB = oCB.Controls.Add(1, , , , True) oCBB.BeginGroup = True oCBB.Caption = "Test2" Set oCBB = Nothing End Function
Thanks a lot Rob :)
No prob.
I had the same problem but for menus a few years ago and that when I found it.:D