+ Reply to Thread
Results 1 to 5 of 5

customize users ribbon (like in excel options) upon open/activation

  1. #1
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    customize users ribbon (like in excel options) upon open/activation

    Hello,



    I know I can customize my ribbon through the excel options, but how to I do it programatically? I was hoping to find some code to add to the workbook_open, workbook_activation events to do the following:

    Upon open or activation the workbook - hide all the usual Excel ribbon areas and show only the special one that was made for said workbook.

    Upon close or deactivation of this same workbook - let the ribbon return to the normal state.

    Thank you
    Last edited by GeneralDisarray; 09-25-2014 at 01:18 PM. Reason: solved the issue
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: customize users ribbon (like in excel options) upon open/activation

    Welcome to the world of XML: http://www.rondebruin.nl/win/section2.htm
    You can also use Andy's add-in from here: http://www.andypope.info/vba/ribboneditor_2010.htm
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: customize users ribbon (like in excel options) upon open/activation

    I edited the XML to make the ribbon in the first place - I was hoping the solution was a bit more straightforward than using another add-in.

    I mean, to make the ribbon appear you only have to:

    Change the workbook file name to end in .zip and extract the contents,
    Edit the file in the _rels directory to include this tag:

    <Relationship Id="someID" Type="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility" Target="customUI/customUI.xml"/>

    Make a new directory in the root directory you extracted the contents too named customUI, and a place a file named customUI.xml (this just matches the path identified as Target in the tag you add to the rels file)

    For my own project, the customUI file just reads:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon>
    <tabs>
    <tab id="CustomTab" label="SNB Report">
    <group id="SampleGroup" label="Comment Tasks">
    <button id="Button3" label="Sync Comments" imageMso="AccessRefreshAllLists" size="large" onAction="ribbonControl_runSyncWithServer" />
    </group >
    <group id="SNB_admin" label="Admin Tasks">
    <button id="Button4" label="Upload SAP Data Set" imageMso="ViewsAdpDiagramSqlView" size="large" onAction="Upload_Latest_SAP" />
    </group>
    <group id="Table_Sort" label="Admin Tasks">
    <button id="Button5" label="Sort" imageMso="SortFilterMenu" size="large" onAction="sort_query_table" />
    </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>



    Does someone know which xml file to edit to set some kind of "don't show this tab" option for the rest of the ribbon?


    Thank you romperstomper - i may just have to use the add in but would really like to just understand the proccess a bit more.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: customize users ribbon (like in excel options) upon open/activation

    All you need is the startfromscratch attribute in the CustomUI.xml - I'm pretty sure Ron covers this.

  5. #5
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: customize users ribbon (like in excel options) upon open/activation

    Well, I wasn't able to find it on Ron's site.

    But thank you for naming the attribute, after googling "startFromScratch" I found a good link: http://msdn.microsoft.com/en-us/libr...ffice.12).aspx

    All I needed to change was the one tag:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon startFromScratch="true">
    <tabs>
    <tab id="CustomTab" label="SNB Report">
    <group id="SampleGroup" label="Comment Tasks">
    <button id="Button3" label="Sync Comments" imageMso="AccessRefreshAllLists" size="large" onAction="ribbonControl_runSyncWithServer" />
    </group >
    <group id="SNB_admin" label="Admin Tasks">
    <button id="Button4" label="Upload SAP Data Set" imageMso="ViewsAdpDiagramSqlView" size="large" onAction="Upload_Latest_SAP" />
    </group>
    <group id="Table_Sort" label="Admin Tasks">
    <button id="Button5" label="Sort" imageMso="SortFilterMenu" size="large" onAction="sort_query_table" />
    </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Unable to Customize Ribbon
    By bkm2016 in forum Excel General
    Replies: 9
    Last Post: 07-14-2014, 11:18 AM
  2. [SOLVED] Customize Ribbon Code. Need Help!
    By Hooty in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2013, 12:45 PM
  3. [SOLVED] Customize Excel Ribbon When File Opens
    By amotto11 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2013, 04:04 PM
  4. Customize Ribbon (Add Button / Assign Macro) in Excel 2010
    By JMax in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2012, 04:46 PM
  5. Need help for Customize Excel Ribbon macros
    By Tareq87 in forum Excel General
    Replies: 6
    Last Post: 05-06-2012, 12:32 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1