Skip to main content

control Element

The control element specifies a clone of an existing control. Built-in controls can be cloned using the idMso attribute. Custom controls cannot be cloned. Custom controls cannot be created using the control element.

When an existing control is cloned, its non-location-specific properties, such as the icon and label, are copied to the clone. Location-specific properties, such as the size and visibility of the control, are not copied. These properties can be set by specifying additional attributes on the control element.

For example, consider the following XML:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
	<ribbon>
		<tabs>
			<tab id="customTab"
			     insertBeforeMso="TabHome"
			     label="Custom Tab">
				<group id="customGroup"
				       label="Custom Group">
					<control idMso="Paste"
					         size="large"
					         screentip="P"/>
					<control idMso="Copy"
					         size="normal"/>
					<control idMso="Cut"
					         showImage="false"/>
					<control idMso="Bold"
					         showLabel="false"/>
					<control idMso="Italic"
					         visible="false"/>
					<control idMso="Underline"
					         enabled="false"/>
				</group>
			</tab>
		</tabs>
	</ribbon>
</customUI>

The result is as follows:

Parent Elements

Children Elements

This element does not support child objects of any kind.

Required Attributes

ATTRIBUTE WHEN TO USE
id Create your own control
idMso Use an existing built-in control

Optional Attributes

STATIC ATTRIBUTE ALLOWED VALUES DEFAULT VALUE
enabled true, false, 1, 0 true
keytip 1 to 3 characters (none)
label 1 to 1024 characters (none)
screentip 1 to 1024 characters (none)
showImage true, false, 1, 0 true
showLabel true, false, 1, 0 true
size normal, large normal
supertip 1 to 1024 characters (none)
tag 1 to 1024 characters (none)
visible true, false, 1, 0 true

 

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>