Microsoft Access VBA Macro Programming

(Tina Sui) #1
The purpose of this extra XML is to create a sample check box in a custom ribbon control
on the Home tab of the user interface. It uses four callbacks, but these have not yet been defined.
If you open the Home tab, you will get error messages that the procedureMyCheckboxdoes
not exist.
You have now defined a check box with a callback calledMyCheckbox. Copy and paste
your XML into the RibbonXML field of the USysRibbons. Exit the database and then reload
it. Open the form where you have set your new ribbon and click Contoso on the menu bar.
Your screen will now look like Figure 11-7, with your new ribbon control My Control at the
end of the ribbon containing a check box.
You can use the Generate Callbacks icon to help generate the code for the callback. This
helps you with the parameters passed across. For example, with a check box there is a
parameter called “pressed.”
Copy the callback for Checkbox1 and paste it into the module you created earlier in the
VBA Editor. Save the file and close it down. When you next load the file, no error messages
will appear since the callback is now defined.

142 Microsoft Access 2010 VBA Macro Programming


Figure 11-7 Access screen showing new ribbon control
Free download pdf