I. Establishment of a functional area
One, XML
First, to determine what the Ribbon will contain, this article assumes that you want to create the Ribbon as shown in the following figure.
which
Open Northwind Traders (the home form in the Access 2007 sample database)
Compress and Repair the database (Access 2007 System features)
Close the database (call the callback function to close the current database)
and loads the Ribbon when the database is open.
To achieve these functions, you need to create the following XML content:
1<customui xmlns= "Http://schemas.microsoft.com/office/2006/01/customui" onload= "Onloadribbon" >
2 <ribbon startfromscratch= "true" >
3 <fileMenu>
4 <button idmso= "OpenDatabase" visible= "false"/>
5 <button idmso= "CloseDatabase" visible= "false"/>
6 <button idmso= "Newdatabase" visible= "false"/>
7 <button idmso= "SaveAs" visible= "false"/>
8 <splitbutton idmso= "Accesssaveasmenu" visible= "false"/>
9 </fileMenu>
Ten <tabs>
One <tab id= "Tabmain" label= "Ribbon test Program" >
<group id= "Grphome" label= "Home" >
<button id= "Cmdhome" label= "open Northwind Traders" imagemso= "Meetingsworkspace" size= "large" onaction= "Onopenformedit" ta g= "Home"/>
<button idmso= "CompactDatabase" size= "large"/>
<button id= "Cmdclose" label= "Close Database" imagemso= "CloseDatabase" size= "large" onaction= "Onclosedatabase"/>
</group>
</tab>
</tabs>
</ribbon>
20</customui>
The first line indicates that the schema for the custom Ribbon is http://schemas.microsoft.com/office/2006/01/customui.
The second line of "startfromscrath=" true "means to close the original ribbon.
The <fileMenu> node describes the Access File menu.
<tabs> nodes describe the grouping of custom ribbon and buttons in groups.