Link to home
Start Free TrialLog in
Avatar of Level7Sensei
Level7Sensei

asked on

Adding Macros to the ribbon in MS Access using USysRibbons

I'm new to using xml, but not new to Access or VBA. I need to create a deployable ribbon that can be customized upon load based on the users role. I am creating this ribbon using a USysRibbons table to hold the XML code. I can add built-in controls no problem. Where I am stuck is adding controls that call saved macros or procedures. Below is code I'm testing with, but line 6 doesn't work. Any help is appreciated!

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  <ribbon startFromScratch="true">
    <tabs>
      <tab id="dbChecklists" label="zChecklists" visible="true">
        <group id="dbRCL_Forms" label="Forms">
          <control idMso="Macro: macRCL_Add" label="Add" enabled="true"/>
        </group>
      </tab>
    </tabs>
  </ribbon>
</customUI>

Open in new window

SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There are also third party tools available, such as Ribbon Creator, which make very short work of this.
Avatar of Level7Sensei
Level7Sensei

ASKER

Still no luck. I changed line 6 to the following:
          <button id="RCL_Add" label = "Add" onaction="btnAdd_RCL" enabled="true"/>

Open in new window


And I added a public procedure as you showed:
Public Sub btnAdd_RCL()
    DoCmd.OpenForm "frmRCL_Add"
End Sub

Open in new window


The XML part isn't being accepted. What am I missing? Thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Interesting!  I actually haven't tried the enabled property on a ribbon command button.  I'll check it out tomorrow... Perhaps you need a similar property such as Locked (?)
Primary failure was using the illegal switch of 'enabled="true"'.