Select Ribbon Name/Ribbon Name Property (1 Viewer)

csoseman

Registered User.
Local time
Today, 14:37
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?
 

MarkK

bit cruncher
Local time
Today, 14:37
Joined
Mar 17, 2004
Messages
8,186
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.
 

csoseman

Registered User.
Local time
Today, 14:37
Joined
Aug 18, 2011
Messages
28
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?
 

MarkK

bit cruncher
Local time
Today, 14:37
Joined
Mar 17, 2004
Messages
8,186
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
 

vbaInet

AWF VIP
Local time
Today, 22:37
Joined
Jan 22, 2010
Messages
26,374
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.
 

Prebez

New member
Local time
Today, 23:37
Joined
Oct 14, 2011
Messages
1
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

Top Bottom