Microsoft Access VBA Macro Programming

(Tina Sui) #1
<tab id="customTab" label="MyMenu" >

<group id="customGroup" label="My New Menu Structure">
<box id="box 1 " boxStyle="horizontal">

<menu id="Group1" label="Group1" >
<button id="id 1 " label="Option 1 " onAction="Action 1 "/>
<menuSeparator id="sep1" />
<button id="id 2 " label="Option 2 " onAction="Action 2 "/>
<button id="id 3 " label="Option 3 " onAction="Action 3 "/>
</menu>
<button id="SP 1 " label=" " enabled="false"/>
<menu id="Group2" label="Group2" >
<button id="id 4 " label="Option 4 " onAction="Action 4 "/>
<button id="id 5 " label="Option 5 " onAction="Action 5 "/>
<menuSeparator id="sep2" />
<menu id="Group3" label="Group3" >
<button id="id 7 " label="Option 7 " onAction="Action 7 "/>
<button id="id8" label="Option8" onAction="Action8"/>
</menu>

<button id="id 6 " label="Option 6 " onAction="Action 6 "/>
</menu>
</box>
</group>

</tab>

</tabs>
</ribbon>
</customUI>

Use the validate option in the Custom UI Editor to ensure that your XML code has been
entered correctly and has no errors. To do this, click the red tick mark in the toolbar (third
icon from the left).
Use Copy and Paste to copy the XML into the USysRibbons table. Copy the XML shown
earlier into the field RibbonXML and enter the nameMyRibbonin the RibbonName field.
Close the Access database and re-open it. Create a new form by clicking Create in the
Access menu and clicking the Forms Design icon in the Forms group of the ribbon.
Right-click the form in Design mode and select Properties. Click Form in the drop-down at
the top of the Properties sheet. Scroll down the Properties list to Ribbon Name and use the
drop-down for this property to select your new ribbon.
Save the form and then open it in View mode. You will see your new menu tab (MyMenu)
and a tree of menu options underneath. Your screen should look like Figure 38-1.

346 Microsoft Access 2010 VBA Macro Programming

Free download pdf