You are here:   Home > Access - Ribbons > Ribbon XML / Controls > Commands

Commands

Commands allow you to manipulate the reaction of built-in Ribbon controls.

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
   <commands>
       <command idMso="Help" enabled="true"/>
       <command idMso="WindowClose" enabled="true"/>
       <command idMso="WindowRestore" enabled="true"/>
       <command idMso="WindowMinimize" enabled="true"/>
       <command idMso="ApplicationOptionsDialog" enabled="true"/>
       <command idMso="FileExit" enabled="true"/>
       <command idMso="PrintDialogAccess" getEnabled="GetEnabled" onAction="CommandOnAction" />
   </commands>
   <ribbon startFromScratch="false">
   </ribbon>
</customUI>

 
The syntax for OnAction callback is a bit different to standard callbacks, as the Cancel parameter has to be provided. This Cancel parameter determines whether only your function or also the standard callback should be processed.

CancelDefault = False

Your code and the standard callback will be executed.

CancelDefault = True

Only your code will be executed.

 

Function in a standard module:

Sub CommandOnAction(control As IRibbonControl, ByRef CancelDefault)
  ' Callback for an Office Ribbon Control -  Click
  MsgBox "My Callback" 
  CancelDefault = True
End Sub

 

Callbacks: getPressed, getEnabled, onAction

You can find this sample also in Sample database Office-Option Button

 

 

Last Updates:

08.04.2018
IDBE RibbonCreator 2016 (x86 and x64) for Office 2013 and Office 2016 - new release. ...


04.08.2017
Add new Link. ...

04.01.2016
Add new Link. ...

22.09.2015
New - IDBE RibbonCreator 2016 32 Bit and 64 Bit (Version 1.1001) ...

 

Last update:
April 09, 2018, 09:50