PDA

View Full Version : [SOLVED] RibbonX customization issues (XML)



nikki333
06-13-2018, 10:53 AM
Hi Folks

Trying to customize the Ribbon on a single file via XML. So I'm using the Custom UI Editor for Microsoft Office to add a "customUI14.xml"

Therefore, it seems that I need to replicate the built-in ribbon tabs (eg. Home, Insert, Developer,...), which works almost as expected.

Only I'm struggling with the "Insert" tab, which now doesn't show the insert symbols group, although it's included in the XML code like so:

<?xml version="1.0" encoding="utf-8"?>
<customUI onLoad="RibbonOnLoad" xmlns="http://schemas.microsoft.com/office/2009/07/customui">


<!-- Set startFromScratch to true to hide the Ribbon and QAT (Quick Access Toolbar)-->
<ribbon startFromScratch="true">


<!-- Create a custom tab for every original tab on the Ribbon with the same name. -->
<!-- Add every origenal group to this custom tabs to duplicate the original tabs. -->
<!-- We can now use getVisible to hide/display the tabs with a VBA macro. -->
<!-- Note: Normal getVisible is not working for specific built-in tabs/groups/controls. -->


<tabs>
<!--Custom Einfügen Tab-->
<tab id="MyCustomInsertTab" label="Einfügen" insertAfterMso="TabInsert" getVisible="GetVisible" tag="ribinsert">
<group idMso="GroupInsertTablesExcel" />
<group idMso="GroupInsertIllustrations" />
<group idMso="GroupOfficeExtension" />
<group idMso="GroupInsertChartsExcel" />
<group idMso="GroupSparklinesInsert" />
<group idMso="GroupSlicerInsert" />
<group idMso="GroupInsertLinks" />
<group idMso="GroupInsertText" />
<group idMso="GroupInsertSympbols" />
</tab>
</tabs>


</ribbon>
</customUI>

I'm working on either office 2013 or 2016, if that's relevant.

Any ideas?

Bob Phillips
06-13-2018, 11:19 AM
If you want the builtin ribbons, just set startfromscratch to false?

nikki333
06-13-2018, 11:28 AM
No, the problem is that this would affect any other file as well. The aim is to customize only the file in question...as far as i understood then is that it has to be done via startfromscratch and to replicate the built-in tabs as custom tabs

Bob Phillips
06-13-2018, 01:48 PM
What other file? I customize ribbons all the time and very rarely need to set startfromscratch.

nikki333
06-13-2018, 03:03 PM
Hi xld

thanks for looking into this.

If you say the other file...that is every other excel file i open after. they all will have the same (restricted/modified) ribbon. That's the reason for the replication as far as i understood (PS. here, only this specific file should behave in a unique stubborn way .))



@lsd could you send me please an example file with one of your ribbon customizations

Paul_Hossler
06-13-2018, 03:26 PM
You might be over complicating it



Option Explicit

Public bShowHomeTab As Boolean
Public oRibbon As IRibbonUI

'Callback for customUI.onLoad
Sub SaveRibbon(ribbon As IRibbonUI)
Set oRibbon = ribbon
bShowHomeTab = True
oRibbon.Invalidate
End Sub

'Callback for TabHome getVisible
Sub ShowHome(control As IRibbonControl, ByRef returnedVal)
returnedVal = bShowHomeTab
End Sub


Sub ToggleShowingHome()
bShowHomeTab = Not bShowHomeTab
oRibbon.Invalidate
End Sub







<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"onLoad="SaveRibbon">
 
 
<!-- **************************************************************************-->
<!-- **********Set visible to false for tabs or groups on the ribbon***********-->
<!-- **************************************************************************-->
<!-- **********You can find the Tab and Group names on this page***************-->
<!-- **************http://www.rondebruin.nl/xmlribbongroups.htm****************-->
<!-- **************************************************************************-->
<!-- ****************Or in one of the downloads on this page*******************-->
<!-- *****************http://www.rondebruin.nl/ribbon.htm**********************-->
<!-- **************************************************************************-->
 
<ribbon>
<tabs>
 
<!-- Set visible to false for the Font group on the Home tab-->
<tab idMso="TabHome" getVisible="ShowHome">
</tab>
</tabs>
</ribbon>
</customUI>
 



With Home hidden (in this simple example, and opening a second WB the second WB's ribbon is 'normal'

Aflatoon
06-14-2018, 01:11 AM
Only I'm struggling with the "Insert" tab, which now doesn't show the insert symbols group, although it's included in the XML code like so:
<group idMso="GroupInsertSympbols" />


Typo. Remove the 'p'.