Results 1 to 4 of 4

Thread: add divider to excel custom toolbar

  1. #1

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Resolved add divider to excel custom toolbar

    How would I programatically add a "divider" to a custom toolbar in Excel ?

    Thanks
    Last edited by TheBionicOrange; Jan 12th, 2005 at 03:36 AM.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: add divider to excel custom toolbar

    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:
    1. 'This will create a new toolbar and create two buttons with a divider between them.
    2. Public Function Test()
    3.     Dim oCB As Office.CommandBar
    4.     Dim oCBB As Office.CommandBarButton
    5.     Set oCB = Excel.CommandBars.Add("Test", , , True)
    6.     oCB.Visible = True
    7.     Set oCBB = oCB.Controls.Add(1, , , , True)
    8.     oCBB.BeginGroup = False
    9.     oCBB.Caption = "Test1"
    10.     Set oCBB = Nothing
    11.     Set oCBB = oCB.Controls.Add(1, , , , True)
    12.     oCBB.BeginGroup = True
    13.     oCBB.Caption = "Test2"
    14.     Set oCBB = Nothing
    15. End Function
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818

    Re: add divider to excel custom toolbar

    Thanks a lot Rob

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: add divider to excel custom toolbar

    No prob.
    I had the same problem but for menus a few years ago and that when I found it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width