Consulting

Results 1 to 7 of 7

Thread: RibbonX customization issues (XML)

  1. #1
    VBAX Regular
    Joined
    Jul 2017
    Location
    Zurich
    Posts
    64
    Location

    RibbonX customization issues (XML)

    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?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master xld's Avatar
    Joined
    Apr 2005
    Posts
    24,908
    Location
    If you want the builtin ribbons, just set startfromscratch to false?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Jul 2017
    Location
    Zurich
    Posts
    64
    Location
    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

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master xld's Avatar
    Joined
    Apr 2005
    Posts
    24,908
    Location
    What other file? I customize ribbons all the time and very rarely need to set startfromscratch.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    Jul 2017
    Location
    Zurich
    Posts
    64
    Location
    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

  6. #6
    VBAX Wizard
    Joined
    Apr 2007
    Posts
    5,861
    Location
    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'
    Attached Files Attached Files
    Paul

    ------------------------------------------------------------------------------------------------------------------------
    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s)
    (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  7. #7
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    Not far
    Posts
    1,541
    Quote Originally Posted by nikki333 View Post
    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'.
    Be as you wish to seem

Posting Permissions

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