repete90
repete90

Reputation: 81

Excel CustomUI Ribbon Placement Next To Another CustomUI Ribbon Tab

I have two custom ribbons on excel, I can not combine them. I would like to make it so that one is always "before" or "after" the other custom tab. But I can't figure out how to program the XML to accomplish this.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" onLoad="OnCustomUILoaded">
<ribbon startFromScratch="false">
    <tabs>
        <tab id="CustomTab" label="MyTab" insertAfterMso="OtherCustomTab">
            ***********************
        </tab>
    </tabs>
</ribbon>
</customUI>

This will place my "customTab" at the very end regardless of where the "otherCustomTab" is located.

I have played around with insertAfterQ="OtherCustomTab", but this does the same thing (places "customTab" at the very end regardless of where "otherCustomTab" is located).

Upvotes: 2

Views: 1247

Answers (1)

repete90
repete90

Reputation: 81

After a lot of toying around, I figured it out. I have a dummy ribbon and here is a XML fragment from that:

Dummy ribbon:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:x="ns" >
        <ribbon>
            <tabs>
                <tab idQ="x:SettingsTab" label="SettingsTab" insertBeforeMso="TabHome" visible="false" >
            </tab>
        </tabs>
    </ribbon>
</customUI>

Main Ribbon:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:x="ns" onLoad="OnCustomUILoaded">
    <ribbon startFromScratch="false">
        <tabs>
            <tab id="CustomTab" getLabel="GetLabel" insertAfterQ="x:SettingsTab" >
                ***************
            </tab>
        </tabs>
    </ribbon>
 </customUI>

The main thing is to make sure that the dummy ribbon is called before the main ribbon.

The benefit to this approach is I can have 8 or 9 different dummy ribbon .xlam workbooks, each having a different "insertBeforeMso" or "InsertAfterMso". Then I can just simply put the dummy ribbon .xlam workbook in the XLSTART Folder, and the main ribbon will change position with ease depending on which dummy ribbon I put in there.

Upvotes: 1

Related Questions