You are here: Home > Access - Ribbons > Ribbon XML / Controls > Manipulate existing Access Ribbons
Manipulate existing Access Ribbons
In Ribbon XML you have the option to replace existing Access Ribbon functionality with user-defined commands, see section <commands>.
Following example illustrates how to replace the Access functions "Cut" and "Copy".
Sample Ribbon XML file:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> <commands> <commands idMso="Cut" onAction="CallbackCut"/> <commands idMso="Copy" onAction="CallbackCopy"/> </commands> </customUI>
Here you can find the description on how to identify idMso of Access controls.
Clicking one of the buttons will now execute the appropriate callback. The same happens on ExcecuteMso.
Application.CommandBars.ExecuteMso("Copy")
Contents of module "basCallbacks":
Option Compare Database Option Explicit Sub CallbackCut(control As IRibbonControl, _ ByRef bolCancel As Boolean) MsgBox "Cut" bolCancel = True End Sub Sub CallbackCopy(control As IRibbonControl, _ ByRef bolCancel As Boolean) MsgBox "Copy" bolCancel = True End Sub
You can find this sample in Sample DB 1