2

Im running 2016 Standalone Excel (32bit version). I've been building a custom ribbon and so far so good. The documentation is pretty fluid and well written. However, I cant find any way to include menu 'section titles' as seen below:

enter image description here

Specifically referencing section titles like in the picture (i.e., 'Cell size', 'Visibility' etc). I've seen other Add-Ins emulate this, unless they are COM Add-Ins. Here is the documentation I reference: https://msdn.microsoft.com/en-us/library/dd911038(v=office.12).aspx

Is it out of date? I've tried adding 'Menu with Title' to my project but that doesn't even work. I've also tried adding <labelControl /> , and the ribbon doesn't even load when the labelControl is within a Menu.

Additionally, my version of Excel won't even display a <dialogBoxLauncher> so I'm concerned some things just aren't compatabile with my Excel version to begin with. I'm following the documentation easily and everything else has worked just fine. I even have a editBox in the ribbon I use and don't run into any 91 errors with it. So I know it's not me.

Can anyone duplicate this with the provided API? My ribbon is structured with XML, so I've reduced as much error potential as possible, is that my problem? Should there be run-time code implemented specifically for section titles?


Short snippet of my setup

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnRibbonLoad">

<ribbon>
<tabs>
<tab idMso="TabHome">        

<group id="GroupTextTools" insertAfterMso="GroupFont" label="Text Tools">
    <gallery  id="textcase_gallery" label="Case Select" columns="1" size="large" imageMso="WordArtInsertDialogClassic" onAction="TextCase_SwitchCase" >
        <item id="textcase_CapsButton" imageMso="TextAllCaps" label="Uppercase" screentip="Changes selected cells to all uppercase" />
        <item id="textcase_ProperButton" label="Propercase" imageMso="ChangeCaseDialogClassic" screentip="Changes selected cells to proper case" />
        <item id="textcase_LowerButton" label="Lowercase" imageMso="FontSizeDecrease" screentip="Changes selected cells to all small case" />
    </gallery>
</group>
</tab>

<tab id="CustomTab" label="*removed*" insertAfterMso= "TabDeveloper">

<!--
  GROUP A
-->
<group id="GroupFileOptions" label="File Options">

  <button id="fileoptions_CloseButton" label="Close &amp;&amp; Reopen" onAction="RunMacro" imageMso="SourceControlCheckIn" size="large" screentip="Saves Document, Closes &amp;&amp; Reopens immediately"/>

  <menu id="exportingmenu" label="Exporting" imageMso="FileCheckOut" size="large" screentip="Exporting Options">
      <menu id="exportmenu_AsRange" label="As Range"> <!-- This is where I would like section Titles to be instead of another menu -->
        <button id="exportmenu_range_CSVCButton" label="To CSV w/commas"/>
        <button id="exportmenu_range_CSVSButton" label="To CSV w/spaces"/>
        <button id="exportmenu_range_PDF" label="To PDF"/>
      </menu>
      <menu id="exportmenu_AsSheet" label="As Sheet"> <!--Goal is for this to be a section title, where I tried putting a <labelControl> -->
      </menu>
  </menu>

</group>

<!-- .... -->
</tab>
</tabs>
</ribbon>
</customUI>
Community
  • 1
  • 1
soulshined
  • 9,612
  • 5
  • 44
  • 79
  • Are you building this as XML within CustomUI Editor? Can you share some example of your XML? – David Zemens Jan 12 '17 at 14:21
  • I sure am @DavidZemens it's no different than your run of the mill custom ribbon. The code I would provide doesn't have any relevance in my opinion, because it's working. The code that breaks it is when I use `` It works just fine if I use `` it also breaks if I use `` inside a menu as mentioned above. But if it helps you I'm all for it! – soulshined Jan 12 '17 at 14:26
  • 1
    Can't argue with that @DavidZemens - valid point. I have included it. Its just a synopsis, but if you need more let me know. I'm aware the 'gallery' doesn't need to be a gallery, I'm just learning the ribbon elements so I wanted to try everything out for familiarization. Don't roast me :P ... too bad – soulshined Jan 12 '17 at 14:39
  • I have never done this so I will probably be way out on this but just a stab in the dark .. shouldn't your `` element be within a `` element? – Zac Jan 12 '17 at 14:50
  • its okay @Zac any help is better than no help. But it is, i just didn't finish it because its just more of the same, more groups, more buttons, more menus. Like I said, the actual ribbon works fine as is, but when I enter a menu with a title (``), it breaks. Or when I put a `` in a menu to see if I could use that as a section title, it didn't care for that either. Otherwise, its a well oiled machine – soulshined Jan 12 '17 at 14:53
  • And just to clarify @DavidZemens i did read on the documentation that labels parent elements are 'box'/'group' so I knew it wouldn't work when placing a box in a menu, but I was optomistic Microsoft missed something when lol – soulshined Jan 12 '17 at 15:02
  • I'm having trouble getting this XML to validate in the Custom UI Editor (I had to add some closing tags, etc., but still won't validate), can you update with valid XML? – David Zemens Jan 12 '17 at 15:04
  • @DavidZemens interesting, maybe because I'm altering the TabHome groups as well. I added the closing tags. Validates on my end – soulshined Jan 12 '17 at 15:09
  • ok that did it I must've fat-fingered something (I need to use scheme from 2009/07 though). Stand by... – David Zemens Jan 12 '17 at 15:11
  • Oh wait - that might be an indirect issue in itself. I didn't see any schema references for 2009 - it only states 2006 all over the website. Still don't think that would fix the section titles problem, but maybe the menu titles issue – soulshined Jan 12 '17 at 15:15
  • I don't *think* that would be the error, either, but there may be some small changes between the 2007 and 2010 schemas ... – David Zemens Jan 12 '17 at 15:16
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/133013/discussion-between-soulshined-and-david-zemens). – soulshined Jan 12 '17 at 15:18

2 Answers2

2

After some trial and error, and an involuntary push from David Zemens by troubleshooting my errors, I've found that by cross referencing all the things I've tried with their Parent Elements, the only one that makes logical compiling sense is a <menuSeparator>, which just so happens to have a 'title' attribute. So by setting that you get a beautiful section title as shown:

enter image description here

<menuSeparator id="someID" title="Test title"/>
Community
  • 1
  • 1
soulshined
  • 9,612
  • 5
  • 44
  • 79
  • 2
    Well done! I notice this in the documentation (page you linked to in OP) as well: "This element specifies a menu control that, *because of its location*, can optionally include a title string via the title or getTitle attributes. It otherwise behaves identically to the regular menu element, as specified in section 2.2.28." When I look at 2.2.28, there is no "title" attribute! So it seems this "title" (and the corresponding "getTitle" callback) are only available in some contexts. – David Zemens Jan 12 '17 at 15:36
  • I wonder where everyone goes to for custom IRibbonUI questions @DavidZemens I had to create a tag for this on SO :/ .. lonely island here – soulshined Jan 12 '17 at 15:39
  • 2
    try ribbon/ribbonx tags. still pretty lonely, though :) – David Zemens Jan 12 '17 at 15:46
  • Regarding "some contexts" in @David's comment, it appears that the title attribute and getTitle callback are not support when extending built in contextual menus. – Jamie Garroch - MVP Dec 16 '22 at 19:51
1

I managed to put a menu title only on a dynamicMenu via the getContent callback, which means the xml is defined in VBA as a piece of xml string, not in the customUI xml. Most comprehensive documentation that I found so far on customUI interfaces is on https://msdn.microsoft.com/en-us/library/dd911038(v=office.12).aspx, however the references are pointing only to 2007. This link contains a much more extensive list of controls and options with extra controls for Access as well http://www.accessribbon.de/en/?Access_-_Ribbons:Ribbon_XML___Controls

Dexterial
  • 19
  • 3