Skip to main content

group Element

The group element specifies a grouping of controls on a ribbon tab. All controls displayed in a ribbon tab MUST be contained within a group.

Graphical View of group Attributes

The group element display label attribute only on the Ribbon tab.

For example, consider a group with a single button, as follows:

This is specified using the following XML fragment:

<group id="CustomGroup" label="Custom Group">
    <button id="CustomButton" label="Button" imageMso="HappyFace" />
</group>

Parent Elements

Child Elements

  • box (Box Grouping Container)
  • button (Button)
  • buttonGroup (Button Grouping Container)
  • checkBox (Check Box)
  • comboBox (Combo Box)
  • control (Control Clone)
  • dialogBoxLauncher (Dialog Box Launcher)
  • dropDown (Drop-down Control)
  • dynamicMenu (Dynamic Menu)
  • editBox (Edit Box)
  • gallery (Gallery)
  • labelControl (Text Label)
  • menu (Menu)
  • separator (Separator)
  • splitButton (Split Button)
  • toggleButton (Toggle Button)

Required Attributes

The ididQ, and idMso attributes are mutually exclusive. At least one of these attributes MUST be specified.

ATTRIBUTE WHEN TO USE
id Create your own checkBox
idMso Use an existing built-in checkBox
idQ Create a checkBox shared between namespaces

Optional insert Attributes

The insertAfterMsoinsertAfterQinsertBeforeMso, and insertBeforeQ attributes are mutually exclusive. If none of these attributes are specified, the controls SHOULD be appended to the existing set of controls, in the order they are defined in the XML.

INSERT ATTRIBUTE ALLOWED VALUES DEFAULT VALUE WHEN TO USE
insertAfterMso Valid Mso Group Insert at end of group Insert after built-in control
insertBeforeMso Valid Mso Group Insert at end of group Insert before built-in control
insertAfterQ Valid Group idQ Insert at end of group Insert after shared namespace control
insertBeforeQ Valid Group idQ Insert at end of group Insert before shared namespace control

Optional Attributes and Callbacks

STATIC ATTRIBUTE DYNAMIC ATTRIBUTE ALLOWED VALUES DEFAULT VALUE VBA CALLBACK SIGNATURE FOR DYNAMIC ATTRIBUTE
image getImage 1 to 1024 characters (none) Sub GetImage (control As IRibbonControl, ByRef returnedVal)
imageMso getImage 1 to 1024 characters (none) Sub GetImage (control As IRibbonControl, ByRef returnedVal)
keytip getKeytip 1 to 3 characters (none) Sub GetKeytip (control As IRibbonControl, ByRef returnedVal)
label getLabel 1 to 1024 characters (none) Sub GetLabel (control As IRibbonControl, ByRef returnedVal)
screentip getScreentip 1 to 1024 characters (none) Sub GetScreentip (control As IRibbonControl, ByRef returnedVal)
supertip getSupertip 1 to 1024 characters (none) Sub GetSupertip (control As IRibbonControl, ByRef returnedVal)
tag (none) 1 to 1024 characters (none) (none)
visible getVisible true, false, 1, 0 true Sub GetVisible (control As IRibbonControl, ByRef returnedVal)

Most optional attributes such as image, imageMso, keytip, screentip, supertip have no visible effect on group controls. It appears that you can focus on the label and insert atttributes for the group, safely ignoring the rest of the optional attributes.

Hide Built-in group Controls

The following example hide the Clipboard group and Font group on the Home tab, and also hide Insert Charts group on Insert tab.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
	<ribbon>
		<tabs>
			<tab idMso="TabHome">
				<group idMso="GroupClipboard"
				       visible="false">
				</group>
				<group idMso="GroupFont"
				       visible="false">
				</group>
			</tab>
			<tab idMso="TabInsert">
				<group idMso="GroupInsertChartsExcel"
				       visible="false">
				</group>
			</tab>
		</tabs>
	</ribbon>
</customUI>

Where can I find the full list of idMso?

idMSO Full List in Excel for Windows

idMSO Full List in Excel for Mac

Using a Built-in Group on a Custom Tab

The following example inserts a custom tab before the Home tab. The new custom tab creates copies of three built-in groups: Clipboard Group, Font Group, and Insert Chart Group.

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
	<ribbon>
		<tabs>
			<tab id="customTab"
			     label="Custom Tab"
			     insertBeforeMso="TabHome">
				<group idMso="GroupClipboard"/>
				<group idMso="GroupFont"/>
				<group idMso="GroupInsertChartsExcel"/>
			</tab>
		</tabs>
	</ribbon>
</customUI>

If you want to add other controls, remember that you can find the entire set of group idMso identifiers.

Creating Custom Groups

Custom groups are created by specifying a unique id attribute, rather than referencing the idMso of a built-in group.

<group id="customGroup" label="Custom Group">
	<!-- your ribbon controls here -->
</group>

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>