|Access Developer Reference|
Version Added: Access 2007
expression An expression that returns a Application object.
|CustomUIName||Required||String||The name that will be used to identify the customized Ribbon.|
|CustomUIXML||Required||String||The XML markup code that defines the customized Ribbon.|
To create and make the Ribbon available to Access, you first create a module in the database with a procedure that calls the LoadCustomUI method, passing in the name of the Ribbon and the XML customization markup. The XML markup can come from a Recordset object created from a table, from a source external to the database (such as an XML file that you must parse into a String), or from XML markup embedded directly inside of the procedure.
You can make different Ribbons available by using multiple calls to the LoadCustomUI method, passing in different XML markup, as long as the name of each Ribbon and the id attribute of the tabs that make up the Ribbon are unique.
After the procedure is complete, you then create an AutoExec macro that calls the procedure by using the RunCode action. That way, when the application is started, the LoadCustomUI method is automatically executed and all of the custom Ribbons are made available to the application
The following example creates a Recordset from any table that contains the word "Ribbons" in its name. Then it calls the LoadCustomUI method to load the Ribbons in order to make them available to the database. Finally, it closes the recordset and the reference to the Database object.
|Visual Basic for Applications|