Display Contextual Ribbon at the end of a Custom Ribbon

Hi,

     I have an Access application that uses a Custom Ribbon (created from an XML file).  The Access Ribbon isn't displayed at all.  I also have a Custom Contextual Ribbon (also created from an XML file) that is displayed when a few of the forms have the focus.  

    The displaying of the Custom Ribbon works perfectly and the Contextual Ribbon is displayed when the special forms have the focus.  However, the Custom Ribbon disappears when the Contextual Ribbon is displayed.  I would like the Contextual Ribbon to show up at the end of the main application Custom Ribbon.

     Here is the beginning of the XML file for the Contextual Ribbon.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <ribbon>
    <contextualTabs>

      <tabSet idMso="TabSetFormReportExtensibility">
     
        <tab id="My Contextual Tab" label="Special">

     I'm at a loss of how to make the Contextual tab show up at the end of the main custom Ribbon.

     Any thoughts?

Thanks,
Mike
LVL 18
Data-ManCOOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I was of the impression that Contextual ribbons are shown to the right of the "main" ribbons. See this:

http://office.microsoft.com/en-za/access-help/guide-to-the-access-2010-user-interface-HA010341735.aspx

Which states:

Depending on your context (that is, which object you are working with and what you are doing), one or more contextual command tabs might appear next to the standard command tabs.
Can you show us the "main" ribbon XML, along with the full contextual ribbon XML? Also share how you're toggling those contextual menus?
Data-ManCOOAuthor Commented:
I appreciate your comment Scott, but the link you listed has nothing to do with Custom XML created Ribbons.

My Ribbon XML is stored in UsysRibbons.

Here is the xml for the main ribbon...I cut out the XML in the middle that has all the commands.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <ribbon startFromScratch="false">
    <tabs>
      <tab id="BSItbHome" label="Home" keytip="H">
       
            All my tabs, groups and commands are here.  The XML in this area does not affect the placement of the contextual tab and has been removed..it is also proprietary.

    </tabs>
 
  </ribbon>
 
  <backstage>
    <button idMso="FileCloseDatabase" visible="false"/>
    <button idMso="SaveObjectAs" visible="false"/>
    <button idMso="FileSaveAsCurrentFileFormat" visible="false"/>
    <button idMso="FileOpen" visible="false"/>
    <button idMso="FileSave" visible="false"/>
    <tab idMso="TabInfo" visible="false"/>
    <tab idMso="TabRecent" visible="false"/>
    <tab idMso="TabNew" visible="false"/>
    <tab idMso="TabPrint" visible="true"/>
    <tab idMso="TabShare" visible="false"/>
    <tab idMso="TabHelp" visible="false"/>
    <button idMso="ApplicationOptionsDialog" visible="false"/>
    <button idMso="FileExit" visible="false"/>
  </backstage>
 
</customUI>

In the database options for the current database, I have set the application to use my custom Ribbon.   Works like a champ.  Each form has the Ribbon property set to the above Ribbon, except the few forms that require the Contextual Tab.  Those form have the Ribbon below set in their Ribbon property.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
  <ribbon>
    <contextualTabs>
     
      <tabSet idMso="TabSetFormReportExtensibility">
     
           The tabs and commands are here.

        </tab>

      </tabSet>
    </contextualTabs>
  </ribbon>
</customUI>


I was thinking that there is some XML that will tell the Contextual tab where to display....but haven't had any luck searching.  Although I haven't dug super deep yet....was hoping that another Access expert had some experience with this already.  I can't be the first person to create a custom Ribbon and custom contextual tab.

Thanks,
Mike
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
The link was geared toward the way ribbons behave in Access, regardless of how they're created.

I reviewed an application where I do the same thing - create ribbons using XML, and have contextual ribbons. In my case, I'm using a class module to manage the ribbons, but essentially I store the XML in the USysRibbon table and call it as needed. Note I'm setting the RibbonName property of the Form or Report, and not using the Event Properties window.

I just include everything in that "contextual" ribbon that is needed, including the "main" ribbon code. So if my main ribbon XML is this:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" loadImage="LoadImages">
  <ribbon startFromScratch="true">
    <tabs>
      <tab id="tab0" label="Home" getVisible ="GetVisible" tag = "RibbonName:=ABB_Standard;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=" > 
        <group id="grpHome" autoScale="true" centerVertically="false" label="App Name" getVisible ="GetVisible" tag = "RibbonName:=ABB_Standard" > 
          <button id="btnAppExit" size="large" label="Exit App" screentip="Quit App" supertip=" " imageMso="AudioBookmarkRemove" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button id="btnlogout" size="large" label="Logout" screentip="Logout of App, don't exit" supertip=" " imageMso="InheritPermissions" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
        </group>
        <group id="grpSort" autoScale="false" centerVertically="false" label="Sorting and Filtering" getVisible ="GetVisible" tag = "RibbonName:=ABB_Standard" > 
          <button idMso="AdpOutputOperationsSortAscending" size="large" label="Ascending" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="AdpOutputOperationsSortDescending" size="large" label="Descending" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="SortAndFilterAdvanced" size="large" label="Advanced Filter" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="ApplyFilter" size="large" label="Apply Filter/Sort" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
        </group>
        <group id="grpEdit" autoScale="false" centerVertically="false" label="Edit" getVisible ="GetVisible" tag = "RibbonName:=ABB_Standard" > 
          <button idMso="Cut" size="large" label="Cut" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="Copy" size="large" label="Copy" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
          <button idMso="Paste" size="large" label="Paste" tag="RibbonName:=ABB_Standard;inMenu:=;CustomTagValue1:=;CustomTagValue2:=;CustomTagValue3:=;CustomPicture:=;CustomPicturePath:=" onAction="OnActionButton" getVisible="GetVisible" getEnabled="GetEnabled" />
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Open in new window

I'd add my contextual XML to THAT XML, and show that as my "contextual" ribbon. In my case, this worked out best, but of course there may be other ways to manage it. Downside is that if you must modify the "home" ribbon, you'd have to tweak your "contextual" ribbon XML as well. My "home" ribbon is very simple, so it's not really a big issue for me.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Data-ManCOOAuthor Commented:
Thanks Scott, I will give that a try.  It seems logical and should work.  I just thought there should be a way within a contextual Ribbon to show where it is displayed.

I will let you know,
Mike
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I never could find a way ....
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Have you looked at Gunter's example for Contextual Tabs?

http://www.accessribbon.de/en/index.php?Downloads:17

mx

Contextual Tab
Data-ManCOOAuthor Commented:
The solution seemed strange in that you reuse the original Ribbon XML and append the Contextual Tab XML at the end.  Maintainability is harder due to multiple identical XML that will all need to be changed if one changes.  I awarded 100 points to the last post as it shows the Contextual Tab XML mixed with base Ribbon XML.

Thanks for all your help,
Mike
aka Data-Man
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.