{"text_format":"1","workbook":"xlsx","n_sheets":6,"sheets":["Menu","Ron","Dave","RonDave","All","Special"],"not_rendered":{"charts":0,"images":0,"macros":1,"external_links":0,"defined_names":0,"comments":0,"pivot_tables":0},"unopened":[],"bounds":{"document_bytes":16777216,"sheet_cells":100000,"rows_first":2000,"rows_last":500,"rows_between":2000,"halvings":0,"cell_chars":16384,"cell_head_chars":4096},"cells_cut":0,"cells_raw":0,"read":"whole","date_system":"1900"}

{"sheet":"Menu","index":0,"n_rows":83,"n_cols":2,"rows_kept":83,"cut":false,"hidden":false,"merged":[]}
[]
[null,"Display another Tab on the Ribbon when you select another worksheet"]
[]
[null,"The RibbonX in this file use startFromScratch to true to hide the Ribbon and QAT and"]
[null,"add three Custom Tabs on the Ribbon. When you open the workbook you not see the tabs."]
[null,"You see that I add getVisible=\"GetVisible\" in every line that add a Custom Tab to the Ribbon in the RibbonX"]
[null,"You also see tag=\"nameofthetag\" in this xml line, we use this Tag in the code to tell which tab we want to hide or show."]
[null,"Note:  You can use the same Tag for more Id's if you want."]
[null,"Use the Custom UI Editor to see or edit the RibbonX if you want (I also Paste it on this Menu sheet)."]
[]
[null,"We will use code in the Workbook_SheetActivate event in the ThisWorkbook module to display the tab we want."]
[null,"Tip : You can also use the CodeName of the worksheets (see commented code in the ThisWorkbook module)"]
[]
[null,"Private Sub Workbook_SheetActivate(ByVal Sh As Object)"]
[null,"    Select Case Sh.Name"]
[null,"    Case \"Ron\": Call RefreshRibbon(Tag:=\"Xron\")"]
[null,"    Case \"Dave\": Call RefreshRibbon(Tag:=\"Xdave\")"]
[null,"    Case \"RonDave\": Call RefreshRibbon(Tag:=\"X*\")"]
[null,"    Case \"All\": Call RefreshRibbon(Tag:=\"*\")"]
[null,"    Case Else: Call RefreshRibbon(Tag:=\"\")"]
[null,"    End Select"]
[null,"End Sub"]
[]
[null,"In the Thisworkbook module it will run this line in the Workbook_SheetActivate event :"]
[]
[null,"    Case Else: Call RefreshRibbon(Tag:=\"\")"]
[]
[null,"Because Tag = \"\" it will not show the custom tabs when you activate this worksheet."]
[]
[null,"Select another worksheet and look at the Ribbon"]
[]
[]
[null,"This is the RibbonX of this workbook :"]
[]
[null,"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"]
[null,"<customUI onLoad=\"RibbonOnLoad\" xmlns=\"http://schemas.microsoft.com/office/2006/01/customui\">"]
[]
[null,"  <!-- Add three Custom tabs to the ribbon with your favorite buttons-->"]
[null,"  <!-- The example will add one group with buttons on each tab -->"]
[]
[null,"  <ribbon startFromScratch=\"true\">"]
[]
[null,"    <tabs>"]
[]
[null,"      <tab id=\"MyCustomTab1\" label=\"Ron\" insertAfterMso=\"TabHome\" getVisible=\"GetVisible\" tag=\"Xron\">"]
[]
[null,"     <group id=\"customGroup1\" label=\"Ron's Group\">"]
[null,"          <button id=\"customButton1\" label=\"Caption 1\" size=\"normal\" onAction=\"Macro1\" imageMso=\"DirectRepliesTo\" />"]
[null,"          <button id=\"customButton2\" label=\"Caption 2\" size=\"normal\" onAction=\"Macro2\" imageMso=\"AccountMenu\" />"]
[null,"          <button id=\"customButton3\" label=\"Caption 3\" size=\"normal\" onAction=\"Macro3\" imageMso=\"RegionLayoutMenu\" />"]
[null,"        </group>"]
[]
[null,"     </tab>"]
[]
[null,"    <tab id=\"MyCustomTab2\" label=\"Dave\" insertAfterMso=\"TabHome\" getVisible=\"GetVisible\" tag=\"Xdave\">"]
[]
[null,"        <group id=\"customGroup2\" label=\"Dave's Group\">"]
[null,"          <button id=\"customButton4\" label=\"Caption 4\" size=\"normal\" onAction=\"Macro4\" imageMso=\"TextAlignGallery\" />"]
[null,"          <button id=\"customButton5\" label=\"Caption 5\" size=\"normal\" onAction=\"Macro5\" imageMso=\"PrintPreviewClose\" />"]
[null,"          <button id=\"customButton6\" label=\"Caption 6\" size=\"normal\" onAction=\"Macro6\" imageMso=\"PrintPreviewShrinkOnePage\" />"]
[null,"          <separator id=\"MySeparator1\" />"]
[null,"          <button id=\"customButton7\" label=\"Caption 7\" size=\"large\" onAction=\"Macro7\" imageMso=\"ReviewPreviousComment\" />"]
[null,"        </group>"]
[]
[null,"     </tab>"]
[]
[null,"    <tab id=\"MyCustomTab3\" label=\"Special\" insertAfterMso=\"TabHome\" getVisible=\"GetVisible\" tag=\"special\">"]
[]
[null,"        <group id=\"customGroup3\" label=\"Special Group\">"]
[null,"          <menu id=\"MyDropdownMenu\" label=\"My Menu\" size=\"large\" imageMso=\"TextAlignGallery\"  >"]
[null,"            <button id=\"customButton8\" label=\"Caption 8\"  onAction=\"Macro8\" imageMso=\"TextAlignGallery\" />"]
[null,"            <button id=\"customButton9\" label=\"Caption 9\"  onAction=\"Macro9\" imageMso=\"TextAlignGallery\" />"]
[null,"            <button id=\"customButton10\" label=\"Caption 10\"  onAction=\"Macro10\" imageMso=\"TextAlignGallery\" />"]
[null,"            <button id=\"customButton11\" label=\"Caption 11\"  onAction=\"Macro11\" imageMso=\"TextAlignGallery\" />"]
[null,"            <button id=\"customButton12\" label=\"Caption 12\"  onAction=\"Macro12\" imageMso=\"TextAlignGallery\" />"]
[null,"          </menu>"]
[null,"        </group>"]
[]
[null,"      </tab>"]
[]
[null,"    </tabs>"]
[null,"  </ribbon>"]
[null,"</customUI>"]

{"sheet":"Ron","index":1,"n_rows":13,"n_cols":2,"rows_kept":13,"cut":false,"hidden":false,"merged":[]}
[]
[]
[]
[null,"You see a tab named \"Ron\" now in the Ribbon"]
[]
[null,"In the ThisWorkbook module it will run this line in the Workbook_SheetActivate event :"]
[]
[null,"    Case \"Ron\": Call RefreshRibbon(Tag:=\"Xron\")"]
[]
[null,"Because Tag = \"Xron\" it will  display the custom tab Ron with the tag \"Xron\" when you activate this worksheet."]
[]
[]
[null,"Select another worksheet and look at the Ribbon"]

{"sheet":"Dave","index":2,"n_rows":13,"n_cols":2,"rows_kept":13,"cut":false,"hidden":false,"merged":[]}
[]
[]
[]
[null,"You see a tab named \"Dave\" now in the Ribbon"]
[]
[null,"In the ThisWorkbook module it will run this line in the Workbook_SheetActivate event :"]
[]
[null,"    Case \"Dave\": Call RefreshRibbon(Tag:=\"Xdave\")"]
[]
[null,"Because Tag = \"Xdave\" it will  display the custom tab Dave with the tag \"Xdave\" when you activate this worksheet."]
[]
[]
[null,"Select another worksheet and look at the Ribbon"]

{"sheet":"RonDave","index":3,"n_rows":13,"n_cols":7,"rows_kept":13,"cut":false,"hidden":false,"merged":[]}
[]
[]
[]
[null,"You see a tab named \"Dave\" and \"Ron\"now in the Ribbon"]
[]
[null,"In the ThisWorkbook module it will run this line in the Workbook_SheetActivate event :"]
[]
[null,"     Case \"RonDave\": Call RefreshRibbon(Tag:=\"X*\")",null,null,null,null,"Note: We use the wildcard * in the Tag"]
[]
[null,"Because Tag = \"X*\" it will  display every custom tab that start with \"X\" when you activate this worksheet."]
[]
[]
[null,"Select another worksheet and look at the Ribbon"]

{"sheet":"All","index":4,"n_rows":13,"n_cols":7,"rows_kept":13,"cut":false,"hidden":false,"merged":[]}
[]
[]
[]
[null,"You see all three custom tabs when you activate this worksheet"]
[]
[null,"In the ThisWorkbook module it will run this line in the Workbook_SheetActivate event :"]
[]
[null,"    Case \"All\": Call RefreshRibbon(Tag:=\"*\")",null,null,null,null,"Note: We use the wildcard * in the Tag"]
[]
[null,"Because Tag = \"*\" it will  show all three custom tabs when you activate this worksheet."]
[]
[]
[null,"Select another worksheet and look at the Ribbon"]

{"sheet":"Special","index":5,"n_rows":13,"n_cols":2,"rows_kept":13,"cut":false,"hidden":false,"merged":[]}
[]
[]
[]
[null,"You see a tab named \"Special\" now in the Ribbon"]
[]
[null,"In the ThisWorkbook module it will run this line in the Workbook_SheetActivate event :"]
[]
[null,"    Case \"Special\": Call RefreshRibbon(Tag:=\"special\")"]
[]
[null,"Because Tag = \"special\" it will  display the custom tab Special when you activate this worksheet."]
[]
[]
[null,"Select another worksheet and look at the Ribbon"]