Solved Ribbon XML - Hide/Show tabs and groups (1 Viewer)

Cris VS

Member
Local time
Today, 10:54
Joined
Sep 16, 2021
Messages
75
Hello,

I am getting started with Ribbon XML because I would like to create a custom one for one of the frontend files of my Access 2016 app. I would like to show only certain commands (so it really isn't creating the ribbon from scratch), but I can't use the default hide/show options because that affects to all the Access files I open in my computer (please correct me if I am wrong).

Therefore, I want to define in the USysRibbons table an XML to show -exclusively in this file- the commands in groups "Clipboard", "Sort & Filter", "Find" and "Records" from tab "Home" and a couple more.

I have read that the difference between setting start from scratch to "true" or to "false" is hiding all the commands or not, so I guess I could use a code that hides them all and then specifies which ones to show... Is this correct? What is the syntax to specify which commands/groups/tabs I want to show?

Thanks a lot
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:54
Joined
Oct 29, 2018
Messages
21,357
Hi. Basically, if you don't want any of the default ribbon tabs to show, you will have to start from scratch and then specify which ribbon tabs and buttons you do want to show.
 

Cris VS

Member
Local time
Today, 10:54
Joined
Sep 16, 2021
Messages
75
What I want to display is some of the default views but only in a specific file, but I don't know how to do it. I thought that maybe it was easier to start from scratch, so I started with this code but I get plenty of error messages that I don't know how to solve:
XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <ribbon startFromScratch="true">
      <tabs>
         <tab id="Home" label="Home">
            <group id="Clipboard" label="Clipboard">
                <button id="Cut" label="Cut" size="normal" imageMso="Cut" onAction=""/>
                <button id="Copy" label="Copy" size="normal" imageMso="Copy" onAction=""/>
                <button id="Paste" label="Paste" size="normal" imageMso="Paste" onAction="" />
                <button id="Format Painter" label="Format Painter" size="large" imageMso="FormatPainter" showLabel="false" onAction="paint" />
            </group>
            <group id="Sort & Filter" label="Sort & Filter">
                <button id="Filter" label="Filter" size="normal" imageMso="FilterToggleFilter" onAction=""/>
                <button id="Ascending" label="Ascending" size="normal" imageMso="SortUp" onAction=""/>
                <button id="Descending" label="Descending" size="normal" imageMso="SortDown" onAction="" />
                <button id="Remove filter" label="Remove filter" size="normal" imageMso="FilterClearAllFilters" onAction="" />
            </group>
            <group id="Records" label="Records">
                <button id="New" label="New" size="normal" imageMso="GoToNewRecord" onAction=""/>
                <button id="Save" label="Save" size="normal" imageMso="RecordsSaveRecord" onAction=""/>
                <button id="Delete" label="Delete" size="normal" imageMso="RecordsDeleteRecord" onAction="" />
                <button id="Refresh" label="Refresh" size="normal" imageMso="RecordsRefreshRecords" onAction="" />
            </group>
            <group id="Find" label="Find">
                <button id="Find record" label="Find record" size="normal" imageMso="FindDialogExcel" onAction=""/>
                <button id="First record" label="First record" size="normal" imageMso="MailMergeGoToFirstRecord" onAction=""/>
                <button id="Previous record" label="Previous record" size="normal" imageMso="MailMergeGoToPreviousRecord" onAction=""/>
                <button id="Next record" label="Next record" size="normal" imageMso="MailMergeGoToNextRecord" onAction="" />
                <button id="Last record" label="Last record" size="normal" imageMso="MailMergeGotToLastRecord" onAction="" />
            </group>
            <button id="Close" label="Closed" size="normal" imageMso="FindDialogExcel" onAction=""/>
         </tab>
         <tab id="Create" label="Create">
            <button id="Query Wizard" label="Query Wizard" size="large" imageMso="CreateQueryFromWizard" onAction="MyButton2CallbackOnAction"/>
            <button id="Query Design" label="Query Design" size="large" imageMso="CreateTableInDesignView" onAction=""/>
         </tab>
         <tab id="External data" label="External data">
            <group id="Import & Link" label="Import & Link">
                <button id="Saved imports" label="Saved imports" size="large" imageMso="ImportSavedImports" onAction=""/>
                <button id="Linked Table Manager" label="Linked Table Manager" size="large" imageMso="DatabaseLinedTableManager" onAction=""/>
                <button id="Excel" label="Excel" size="large" imageMso="ImportExcel" onAction="" />
                <button id="Access" label="Access" size="large" imageMso="ImportAccess" onAction="" />
                <button id="SharePoint List" label="SharePoint List" size="large" imageMso="ImportSharePointList" onAction="" />
            </group>
            <group id="Export" label="Export">
                <button id="Saved exports" label="Saved exports" size="large" imageMso="ExportSavedExports" onAction=""/>
                <button id="Excel" label="Excel" size="large" imageMso="ExportExcel" onAction="" />
                <button id="PDF or XPS" label="PDF or XPS" size="large" imageMso="PageNumberFormat" onAction=""/>
                <button id="Email" label="Email" size="large" imageMso="MailMergeStartEnvelopes" onAction="" />
                <button id="Access" label="Access" size="large" imageMso="ExportAccess" onAction="" />
                <button id="SharePoint List" label="SharePoint List" size="large" imageMso="ExportSharePointList" onAction="" />
            </group>
         </tab>
      </tabs>
   </ribbon>
</customUI>

PS: These are the tags that I want to display in the ribbon
 

LarryE

Active member
Local time
Today, 02:54
Joined
Aug 18, 2021
Messages
562
You can create as many custom ribbons as you wish and then, just load whichever one you want to whichever file. Each ACCESS file gives you the choice as to if you want to load a custom ribbon and which one you want to load at startup. Look under File>>Current Database>>Ribbon and Toolbar Options>>Ribbon Name.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:54
Joined
Oct 29, 2018
Messages
21,357
What I want to display is some of the default views but only in a specific file, but I don't know how to do it. I thought that maybe it was easier to start from scratch, so I started with this code but I get plenty of error messages that I don't know how to solve:
XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <ribbon startFromScratch="true">
      <tabs>
         <tab id="Home" label="Home">
            <group id="Clipboard" label="Clipboard">
                <button id="Cut" label="Cut" size="normal" imageMso="Cut" onAction=""/>
                <button id="Copy" label="Copy" size="normal" imageMso="Copy" onAction=""/>
                <button id="Paste" label="Paste" size="normal" imageMso="Paste" onAction="" />
                <button id="Format Painter" label="Format Painter" size="large" imageMso="FormatPainter" showLabel="false" onAction="paint" />
            </group>
            <group id="Sort & Filter" label="Sort & Filter">
                <button id="Filter" label="Filter" size="normal" imageMso="FilterToggleFilter" onAction=""/>
                <button id="Ascending" label="Ascending" size="normal" imageMso="SortUp" onAction=""/>
                <button id="Descending" label="Descending" size="normal" imageMso="SortDown" onAction="" />
                <button id="Remove filter" label="Remove filter" size="normal" imageMso="FilterClearAllFilters" onAction="" />
            </group>
            <group id="Records" label="Records">
                <button id="New" label="New" size="normal" imageMso="GoToNewRecord" onAction=""/>
                <button id="Save" label="Save" size="normal" imageMso="RecordsSaveRecord" onAction=""/>
                <button id="Delete" label="Delete" size="normal" imageMso="RecordsDeleteRecord" onAction="" />
                <button id="Refresh" label="Refresh" size="normal" imageMso="RecordsRefreshRecords" onAction="" />
            </group>
            <group id="Find" label="Find">
                <button id="Find record" label="Find record" size="normal" imageMso="FindDialogExcel" onAction=""/>
                <button id="First record" label="First record" size="normal" imageMso="MailMergeGoToFirstRecord" onAction=""/>
                <button id="Previous record" label="Previous record" size="normal" imageMso="MailMergeGoToPreviousRecord" onAction=""/>
                <button id="Next record" label="Next record" size="normal" imageMso="MailMergeGoToNextRecord" onAction="" />
                <button id="Last record" label="Last record" size="normal" imageMso="MailMergeGotToLastRecord" onAction="" />
            </group>
            <button id="Close" label="Closed" size="normal" imageMso="FindDialogExcel" onAction=""/>
         </tab>
         <tab id="Create" label="Create">
            <button id="Query Wizard" label="Query Wizard" size="large" imageMso="CreateQueryFromWizard" onAction="MyButton2CallbackOnAction"/>
            <button id="Query Design" label="Query Design" size="large" imageMso="CreateTableInDesignView" onAction=""/>
         </tab>
         <tab id="External data" label="External data">
            <group id="Import & Link" label="Import & Link">
                <button id="Saved imports" label="Saved imports" size="large" imageMso="ImportSavedImports" onAction=""/>
                <button id="Linked Table Manager" label="Linked Table Manager" size="large" imageMso="DatabaseLinedTableManager" onAction=""/>
                <button id="Excel" label="Excel" size="large" imageMso="ImportExcel" onAction="" />
                <button id="Access" label="Access" size="large" imageMso="ImportAccess" onAction="" />
                <button id="SharePoint List" label="SharePoint List" size="large" imageMso="ImportSharePointList" onAction="" />
            </group>
            <group id="Export" label="Export">
                <button id="Saved exports" label="Saved exports" size="large" imageMso="ExportSavedExports" onAction=""/>
                <button id="Excel" label="Excel" size="large" imageMso="ExportExcel" onAction="" />
                <button id="PDF or XPS" label="PDF or XPS" size="large" imageMso="PageNumberFormat" onAction=""/>
                <button id="Email" label="Email" size="large" imageMso="MailMergeStartEnvelopes" onAction="" />
                <button id="Access" label="Access" size="large" imageMso="ExportAccess" onAction="" />
                <button id="SharePoint List" label="SharePoint List" size="large" imageMso="ExportSharePointList" onAction="" />
            </group>
         </tab>
      </tabs>
   </ribbon>
</customUI>

PS: These are the tags that I want to display in the ribbon
Hi. I went through each error and fixed them, so that the error is now gone. This doesn't mean the Ribbon will work though. You still need to fix that part. If you want to use the built-in buttons, I think you simply need to use the idMso attribute. Hope this helps...
XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <ribbon startFromScratch="true">
      <tabs>
         <tab id="Home" label="Home">
            <group id="Clipboard" label="Clipboard">
                <button id="Cut" label="Cut" size="normal" imageMso="Cut" />
                <button id="Copy" label="Copy" size="normal" imageMso="Copy" />
                <button id="Paste" label="Paste" size="normal" imageMso="Paste" />
                <button id="Format_Painter" label="Format Painter" size="large" imageMso="FormatPainter" showLabel="false" onAction="paint" />
            </group>
            <group id="Sort_Filter" label="Sort &amp;&amp; Filter">
                <button id="Filter" label="Filter" size="normal" imageMso="FilterToggleFilter" />
                <button id="Ascending" label="Ascending" size="normal" imageMso="SortUp" />
                <button id="Descending" label="Descending" size="normal" imageMso="SortDown" />
                <button id="Remove_Filter" label="Remove filter" size="normal" imageMso="FilterClearAllFilters" />
            </group>
            <group id="Records" label="Records">
                <button id="New" label="New" size="normal" imageMso="GoToNewRecord" />
                <button id="Save" label="Save" size="normal" imageMso="RecordsSaveRecord" />
                <button id="Delete" label="Delete" size="normal" imageMso="RecordsDeleteRecord" />
                <button id="Refresh" label="Refresh" size="normal" imageMso="RecordsRefreshRecords" />
            </group>
            <group id="Find" label="Find">
                <button id="Find_Record" label="Find record" size="normal" imageMso="FindDialogExcel" />
                <button id="First_Record" label="First record" size="normal" imageMso="MailMergeGoToFirstRecord" />
                <button id="Previous_Record" label="Previous record" size="normal" imageMso="MailMergeGoToPreviousRecord" />
                <button id="Next_Record" label="Next record" size="normal" imageMso="MailMergeGoToNextRecord"  />
                <button id="Last_Record" label="Last record" size="normal" imageMso="MailMergeGotToLastRecord" />
                <button id="Close" label="Closed" size="normal" imageMso="FindDialogExcel" />
          </group>
         </tab>
         <tab id="Create" label="Create">
        <group id="Misc" label="Misc">
            <button id="Query_Wizard" label="Query Wizard" size="large" imageMso="CreateQueryFromWizard" onAction="MyButton2CallbackOnAction"/>
            <button id="Query_Design" label="Query Design" size="large" imageMso="CreateTableInDesignView" />
       </group>
         </tab>
         <tab id="External_Data" label="External Data">
            <group id="Import_Link" label="Import &amp;&amp; Link">
                <button id="Saved_Imports" label="Saved imports" size="large" imageMso="ImportSavedImports" />
                <button id="Linked_Table_Manager" label="Linked Table Manager" size="large" imageMso="DatabaseLinedTableManager" />
                <button id="Excel_Import" label="Excel" size="large" imageMso="ImportExcel" />
                <button id="Access_Import" label="Access" size="large" imageMso="ImportAccess" />
                <button id="SharePoint_List_Import" label="SharePoint List" size="large" imageMso="ImportSharePointList" />
            </group>
            <group id="Export" label="Export">
                <button id="Saved_Exports" label="Saved exports" size="large" imageMso="ExportSavedExports" />
                <button id="Excel_Export" label="Excel" size="large" imageMso="ExportExcel" />
                <button id="PDF_XPS" label="PDF or XPS" size="large" imageMso="PageNumberFormat" />
                <button id="Email" label="Email" size="large" imageMso="MailMergeStartEnvelopes" />
                <button id="Access_Export" label="Access" size="large" imageMso="ExportAccess" />
                <button id="SharePoint_List_Export" label="SharePoint List" size="large" imageMso="ExportSharePointList" />
            </group>
         </tab>
      </tabs>
   </ribbon>
</customUI>
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:54
Joined
Oct 29, 2018
Messages
21,357
If you want to use the built-in buttons, I think you simply need to use the idMso attribute.
To illustrate what I mean, after you copy and paste the above ribbon xml into your project, check out the Create tab.

Now compare it to what I did here. I changed this part:
XML:
         <tab id="Create" label="Create">
        <group id="Misc" label="Misc">
            <button id="Query_Wizard" label="Query Wizard" size="large" imageMso="CreateQueryFromWizard" onAction="MyButton2CallbackOnAction"/>
            <button id="Query_Design" label="Query Design" size="large" imageMso="CreateTableInDesignView" />
       </group>
         </tab>
into this:
XML:
         <tab id="Create" label="Create">
        <group id="Misc" label="Misc">
            <button idMso="CreateQueryFromWizard" size="large"/>
            <button idMso="CreateTableInDesignView" size="large"/>
       </group>
         </tab>
I hope you see the difference (both in look and function).
 

Cris VS

Member
Local time
Today, 10:54
Joined
Sep 16, 2021
Messages
75
To illustrate what I mean, after you copy and paste the above ribbon xml into your project, check out the Create tab.

Now compare it to what I did here. I changed this part:
XML:
         <tab id="Create" label="Create">
        <group id="Misc" label="Misc">
            <button id="Query_Wizard" label="Query Wizard" size="large" imageMso="CreateQueryFromWizard" onAction="MyButton2CallbackOnAction"/>
            <button id="Query_Design" label="Query Design" size="large" imageMso="CreateTableInDesignView" />
       </group>
         </tab>
into this:
XML:
         <tab id="Create" label="Create">
        <group id="Misc" label="Misc">
            <button idMso="CreateQueryFromWizard" size="large"/>
            <button idMso="CreateTableInDesignView" size="large"/>
       </group>
         </tab>
I hope you see the difference (both in look and function).
Thank you so much!! All clear
 

Users who are viewing this thread

Top Bottom