Results 1 to 18 of 18

Dynamically sized menu in customised Ribbon tab

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Dynamically sized menu in customised Ribbon tab

    I am trying to create a dynamically sized menu in a customised Ribbon tab (where the number of macros to include on the menu is defined in VBA not XML) and I can not get this to work.

    It might be simpler to explain what I am after by demonstrating a similar concept (ignoring the customised tab aspect): I can create a XLAM containing grouped controls which appear in the Add-Ins tab. The number of macros to include the group are dynamically bound (sample below):

    Popup1MacNames = Array("Macro1", "Macro2", "Macro3", "Macro4")

    With Office.CommandBarControl
    With .Controls.Add(Type:=msoControlPopup, temporary:=True)
    .Caption = "Caption1"
    .BeginGroup = True
    .Tag = C_TAG
    For iCtr = LBound(Popup1MacNames) To UBound(Popup1MacNames)
    With .Controls.Add(Type:=msoControlButton, temporary:=True)
    .OnAction = "'" & ThisWorkbook.Name & "'!" & Popup1MacNames(iCtr)
    .Caption = Popup1MacNames(iCtr)
    .Tag = C_TAG
    End With
    Next iCtr
    End With


    As can be seen with above code, to link a new macro to this group, all I need to do is type the sub name into the Array line.

    Now I wish to do the equivalent in a customised ribbon tab. And I need to define the size of the menu in VBA, not in XML.

    I am already using Bob Phillips Dynamic Ribbon code - I need to add a menu to contain a list of macros. And the ability to easily add extra macros to this menu without having to edit the XML every single time.
    Last edited by mc84excel; 12-13-2012 at 06:56 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1