SETHA SITE INFORMATION

  • Increase font size
  • Default font size
  • Decrease font size
Microsoft Access

How to Create Customized Ribbon in Microsoft Access 2007

E-mail Print PDF

This article shows you one scenario about how to create a customized Office Fluent Ribbon in Microsoft Access 2007. This article applies to only Microsoft Office Access Database not include the Microsoft Office Access Project (*.ADP). To customized our own Ribbon we need to know some of XML markup text.

Scenario for creating customized Office Fluent Ribbon in Microsoft Access 2007

  • Step 1: Create New Project Database or Open your existing Project Database
  • Step 2: Create New Table named USysRibbons with the following fields:
    Field NameData TypeDescription
    RibbonNameTextUnique name that identifies the UI extensibility customizations in the RibbonXML field.
    RibbonXMLMemoRibbonXML that describes a set of customizations to be applied to the Office Fluent UI.
  • Step 3: Create one Tab named Home
    Add New record to USysRibbons table as below:
    Field NameContent
    RibbonNameHome
    RibbonXML
    <customUI 
     xmlns="http://schemas.microsoft.com/office/2006/01/customui">
     <ribbon startFromScratch="true">
      <tabs>
       <tab id="tabMain" label="Home">
       </tab>
      </tabs>
     </ribbon>
    </customUI>
    

    * Note: Use <tab id="..." label="..."></tab> tag to create Tab on Ribbon.
  • Step 4: Set your customized Ribbon as the Startup Ribbon
    • Close and restart the application.
    • Click the Microsoft Office Button, and then click Access Options.
    • Click Current Database in the left pane.
    • In the Ribbon and Toolbar Options section, select the Home Ribbon in the Ribbon Name list.
    • Close and restart the application.


     
  • Step 5: Create Group named List
    Modify the above record in USysRibbons table as below:
    Field NameContent
    RibbonNameHome
    RibbonXML
    <customUI 
     xmlns="http://schemas.microsoft.com/office/2006/01/customui">
     <ribbon startFromScratch="true">
      <tabs>
       <tab id="tabMain" label="Home">
          <group id="grpList" label="List">
          </group>
       </tab>
      </tabs>
     </ribbon>
    </customUI>
    

    * Note: Use <group id="..." label="..."></group> tag to create Group under the Tab of Ribbon.

     
  • Step 6: Create Button in List Group
    Just modify the record in USysRibbons table as follow
    Field NameContent
    RibbonNameHome
    RibbonXML
    <customUI 
     xmlns="http://schemas.microsoft.com/office/2006/01/customui">
     <ribbon startFromScratch="true">
      <tabs>
       <tab id="tabMain" label="Home">
          <group id="grpList" label="List">
            <button id="cmdBook" label="Book" size="large" 
                supertip="Click here to show list of book"/>
          </group>
       </tab>
      </tabs>
     </ribbon>
    </customUI>
    

    * Note: Use <button id="..." label="..." site="..." supertip="..."></button> tag to create Button in the Group under the Tab of Ribbon.

     
  • Step 7: Add Image to Button
    Modify the above record in table USysRibbons by adding the imageMso attribute into the <button> tag as follow:
    <button id="cmdBook" label="Book" size="large" 
      imageMso="ControlLayoutStacked" 
      supertip="Click here to show list of book"/>
    


     
  • Step 8: Add Action Click on Button
    • Modify the above record in table USysRibbons by adding onAction attribute into the <button> tag as follow:
      <button id="cmdBook" label="Book" size="large" 
        onAction="macRibbons.btnBookClick" 
        imageMso="ControlLayoutStacked" 
        supertip="Click here to show list of book"/>
      
    • Create a macro object named macRibbons
      • Add one macro named cmdBookClick in macRibbons object
      • Choose Action: RunCode
      • In Function Name at the bottom write: btnBookClick()
    • Create function named btnBookClick() in VBA code in a module as follow:
      Public Function btnBookClick()
          MsgBox "Testing click on Book Button"
      End Function
      
    • Close and restart your application

Ref:http://msdn.microsoft.com/en-us/library/bb187398(v=office.12).aspx
 


Page 2 of 2