Consulting

Results 1 to 11 of 11

Thread: Custom Ribbon Add Additional Tab

  1. #1
    VBAX Regular
    Joined
    Jan 2020
    Posts
    13
    Location

    Custom Ribbon Add Additional Tab

    I have just started customising my ribbon using Custom UI Editor, however no matter what I try I can not add an additional tab, can someone please provide a script to add another tab to the script I already have as I would like 2 tabs.

    For some strange reason it will not allow me to post the code or even upload the .txt example, so if someone could provide me a script that has 2 tabs in it then i will just modify that.

    Thanks

  2. #2
    VBAX Newbie
    Joined
    Jan 2020
    Posts
    3
    Location
    You can use VBA's to customize the ribbon, i found this was easier if you are running it on work computers where it seems to slip past the restrictions

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    Probably just the bold below

    
    <!--  This is example : Add custom tab for Favorite Groups and buttons     --> 
    <!--  ****************************************************************************  --> 
    <!--  *You can find the Control/groups names in one of the downloads on this page*  --> 
    <!--  ***************http://www.rondebruin.nl/ribbon.htm**************************  --> 
    <!--  ****************************************************************************  --> 
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <!--  Add Custom tab to the ribbon with your favorite built in groups/controls  --> 
    <!--  The example add three complete groups to the new tab  --> 
    <!--  And create a new group named "Favorite commands" on the new tab  --> 
    <!--  In this group it add four built in controls  --> 
    
    <ribbon>
    <tabs>
    <tab id="customTab" label="Favorite Groups" insertAfterMso="TabHome">
      <group idMso="GroupClipboard" /> 
      <group idMso="GroupSortFilter" /> 
      <group idMso="GroupInsertIllustrations" /> 
      <group id="YouCustomGroup" label="Favorite commands">
      <button idMso="VisualBasic" /> 
      <button idMso="SheetProtect" /> 
      <button idMso="ConvertTextToTable" /> 
      <separator id="MySeparator1" /> 
      <menu idMso="WindowSwitchWindowsMenuExcel" size="large" /> 
      </group>
      </tab>
      </tabs>
      </ribbon>
      </
    
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    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) / 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

  4. #4
    VBAX Regular
    Joined
    Jan 2020
    Posts
    13
    Location
    Thanks, but I use custom images and I haven't found a vba code that allows me to getImage for the buttons.
    Also you have provided code for one tab which I do already, however what I wanted was for 2 custom tabs, I am not sure how to add code to get the 2nd custom tab

  5. #5
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    1. getImage doesn't work for buttons

    2. The process is basically the same for 2 tabs

    Example with 2 new tabs, each with 2 groups, and each group with 2 buttons


    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="ribbonstart">
        <ribbon>
            <tabs>
                <tab id="tab2" label="Tab Two" insertAfterMso="TabHome">
                    <group id="g3" label="Tab2 Group3" >
                        <button id="b5" label="Button5" size="large" onAction="test" image="Dilbert" />
                        <button id="b6" label="Button6" size="large" onAction="test" image="Boss" />
                    </group>
    
    
                    <group id="g4" label="Tab2 Group4" >
                        <button id="b7" label="Button7" size="large" onAction="test" image="Dilbert" />
                        <button id="b8" label="Button8" size="large" onAction="test" image="Boss" />
                    </group>
                </tab>
    
    
                <tab id="tab1" label="Tab One" insertAfterMso="TabHome">
                    <group id="g1" label="Tab1 Group1" >
                        <button id="b1" label="Button1" size="large" onAction="test" image="Dilbert" />
                        <button id="b2" label="Button2" size="large" onAction="test" image="Boss" />
                    </group>
    
    
                    <group id="g2" label="Tab1 Group2" >
                        <button id="b3" label="Button3" size="large" onAction="test" image="Dilbert" />
                        <button id="b4" label="Button4" size="large" onAction="test" image="Boss" />
                    </group>
                </tab>
    
    
    
    
    
    
            </tabs>
        </ribbon>
    </customUI>
    Attached Files Attached Files
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    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) / 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

  6. #6
    VBAX Regular
    Joined
    Jan 2020
    Posts
    13
    Location
    Thank you for your help, much appreciated.
    Yes getImage doesn't work with VBA that is why I am using the Custom UI Editor Which then you can add your own pictures, but it still requires some coding also

  7. #7
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    1. There's a much improved CustomUI editor

    https://github.com/fernandreu/office-ribbonx-editor

    Are you using that one?


    2. In my example, I added two of my own pictures, but the coding only consists of

     ... image=" ... "
    on the <button ... line


    3. BTW, there's a dedicated CustomUI forum here, just below the Word forum
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    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) / 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

  8. #8
    VBAX Regular
    Joined
    Jan 2020
    Posts
    13
    Location
    no, I was using the application Custom UI Editor For Microsoft Office.
    Curious to how it knew where to get the pictures from as I can't see any pictures in the example workbook and my own have to be in a folder so that it can get them.

  9. #9
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    404
    Location
    Quote Originally Posted by Paul_Hossler View Post
    1. getImage doesn't work for buttons
    I don't know, maybe I don't understand. Finally, I don't know English.

    XML code:
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"    onLoad="Rbn_onLoad">
        <ribbon >
            <tabs >
                <tab 
                    id="Tab1"
                    label="Tab1">
                    <group 
                        id="Group1"
                        label="Group1">
                        <button 
                            id="Button1"
                            label="Button1"
                            size="large"
                            getImage="Button1_getImage"/>
                    </group >
                </tab >
            </tabs >
        </ribbon >
    </customUI >
    VBA code:
    Option Explicit
    
    Public xRbn         As IRibbonUI
    
    
    Public Sub Button1_getImage(control As IRibbonControl, ByRef returnedVal)
        '
        ' Code for getImage callback. Ribbon control button
        '
        Dim stPath      As String
    
    
        stPath = "E:\MyFolder\Icons\fingerprint.jpg"
    
        Set returnedVal = LoadPicture(stPath)
    End Sub
    
    
    Public Sub Rbn_onLoad(ribbon As IRibbonUI)
        '
        ' Code for onLoad callback. Ribbon control customUI
        '
        Set xRbn = ribbon
    End Sub
    Artik

  10. #10
    VBAX Regular
    Joined
    Jan 2020
    Posts
    13
    Location
    I have it all sorted out now, Thanks for all your help Paul and the new xml editor is much better than the earlier version.
    Cut my file size down too which is awesome and I don't have to store pictures anymore.

  11. #11
    VBAX Regular
    Joined
    Oct 2021
    Posts
    12
    Location
    Will start a new thread as this one is already marked SOLVED (missed that initially) ...

    Very interesting reading. I just started with Office Ribbon Editor to include a custom tab on my ribbon. The idea is to have buttons from various workbooks (later to be converted to add-ins) on the SAME custom tab.

    The creation of the tab with the first button group worked fine ... see XML code below :

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <customUI xmlns=(note this is redacted because the forum apparently denies posts with URL's in them ... it contains the URL to the 2006-01 custom schemas)>
    <ribbon>
    <tabs>
    <tab id="piAddIns" label="pi Add-ins" insertAfterMso="TabHome" >
    <group id="piGeneralSettings" label="General Settings" >
    <button id="piRegistration" label="Registration" size="large" onAction="UpdateRegistrationSettings" imageMso="AccountSettings" />
    <button id="piLanguage" label="Language" size="large" onAction="SelectLanguage" imageMso="MailMergeRecepientsUseOutlookContacts" />
    </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>

    The problem I have is to then in ANOTHER workbook add XML code that will add that workbook's button to this "new" tab that I just created (called "piAddIns"). I tried XML code below (with variants of id, idQ and idMSO) to no avail. If I could get some help to figure this out (or pointers to what I'm doing wrong), that would be fantastic ...

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <customUI xmlns= (note this is redacted because the forum apparently denies posts with URL's in them)>
    <ribbon>
    <tabs>
    <tab idQ="piAddIns" label="pi Add-ins" >
    <group id="piDatePicker" label="Date Picker" insertAfterQ="piGeneralSettings" >
    <button id="piPickDate" label="Pick a Date" size="large" onAction="DatePickerMacro" imageMso="CalendarsGallery" />
    </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>
    Last edited by pplanch; 10-20-2021 at 03:38 AM. Reason: Thread already marked SOLVED - will start a new discussion

Posting Permissions

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