Select Ribbon Name/Ribbon Name Property

csoseman

Registered User.
Local time
Today, 08:48
Joined
Aug 18, 2011
Messages
28
I know there is VBA to load a ribbon in to the database but is there actual code to set the ribbon or code that corresponds to Access Options --> Current Database --->Ribbon and Toolbar Options --> Ribbon Name?
 
A form has a RibbonName property. Set it to the name of a ribbon and that ribbon appears when that form is open. You can set this property at runtime or design time.
 
A form has a RibbonName property. Set it to the name of a ribbon and that ribbon appears when that form is open. You can set this property at runtime or design time.

For some reason even when I set it I still get the main ribbon. I can see the ribbon in the form properties and have it set but it still shows the default ribbon. Any ideas?
 
I took a second look at how my stuff is working, and the ribbons I assign to forms at runtime are contextual ribbons, so maybe that makes a difference. The xml I use looks like this ...
Code:
<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" >
  <ribbon>
    <contextualTabs>
      <tabSet idMso="TabSetFormReportExtensibility">
        <tab id="tabNormalTab" label="Tab Example">
[COLOR="Green"]          <!-- your ribbon code here -->[/COLOR]
        </tab>
      </tabSet>
    </contextualTabs>
  </ribbon>
</customUI>
...so that's the base code for a contextual ribbon.
Hope this helps,
Mark
 
Nice idea with the contextual tabs lagbolt and a new display pic too :)

For some reason even when I set it I still get the main ribbon. I can see the ribbon in the form properties and have it set but it still shows the default ribbon. Any ideas?
If you want to be able to set the ribbon dynamically, you will need to remove the Default Ribbon you set in Options. Then you will be able to use the RibbonName property.

You can still have the Default Ribbon and change it dynamically but you need some code to invalidate the ribbon during the callbacks.
 
I believe I have found a bug in my installation of Access 2010: When I set the Ribbon property ON MY STARTUP FORM it is ignored. However, if I set it on any subsequently opened form, it works just fine, and shows the relevant ribbon.

Perhaps it is because the AutoExec makro, where I load the ribbon is not the first thing executed?

Anyway, the workaround is making a splash form with a timer that opens the "real" startup form.

Jock
 

Users who are viewing this thread

Back
Top Bottom