ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

How To Customize the Ribbon in Excel 2007 or Excel 2010 | ooxml | RibbonX | Open Office XML

Updated on October 21, 2011

With the introduction of Office 2007, Microsoft added a new UI element to their suite of productivity software: The RibbonX. There two ways that a developer can create and modify the RibbonX in either one of Microsft Office 2007 or 2010 software; through XML or with C# or Vb.Net in Visual Studio. This tutorial focuses on the XML version which is quick and easy way of creating or modifying a Ribbon.

To follow along I recommend using the Custom UI Editor from See the Resources at the end for a link to download this free tool.

XLSX File Format Quick Overview

Excel 2007 and Excel 2010 are archive files.To illustrate create a workbook in Excel:

  • From Windows Explorer navigate to the file created
  • Change the extension to zip. (Note: You have to have the option “show extensions” enabled in Windows Explorer. Also accept the warning about changing the file extension).
  • Open the zip file with any archive utility
  • The archive file contains many XML files and other resource files to make Excel work. Any custom Macros would be saved as .bas files. The same goes for custom forms and images. To create custom UI resources it is best to use a tool like Custom UI Editor or Visual Studio or some other Editor.
  • Rename to extension to .xlsx to revert the zip to its original file extension

CustomUI xml files in Excel

When you add a custom Ribbon Tab in the xlsx (or xlsm macro file) archive a new file is added to the archive depending on the version you choose and the version of Excel. For 2010 you can opt for either one.

  • Excel 2007 : CustomUI.xml
  • Excel 2010 : CustomUI14.xml

The main difference is the namespace

Excel 2007

<customUI xmlns="">

Excel 2010

<?xml version="1.0" encoding="utf-8"?><customUI xmlns="">

In Excel 2010 New Element:backstage

In 2010 you can enclosed your Custom UI in the Backstage so that it will appear in the file menu rather than as a Tab in the Ribbon:

<?xml version="1.0" encoding="utf-8"?>
<customUI xmlns="">
<tab id="customTab" label="Custom">

To add or modify a custom UI element

  1. Use the CustomUI Tool which is available from (see the Resource section at the end off this article for the url)
  2. Open the xlsx file
  3. Either right click on the file name in the Explorer on the left hand side or select from the Insert menu, choose to add one of the two custom ui parts:
  4. Office 2010 Custom UI Part
  5. Office 2007 Custom UI Part
  6. You can either add your own xml code in the editor on the right, or choose to insert a sample, see Sample XML submenu in the Insert menu. Please see the Resources for listing on the complete RibbonX XML reference and also for the 2007 and 2010 Control IDs if you need to access a built-in command.
  7. To add a custom icon, right click on the xml file Custom UI Part and select “Insert Icons”. Only png (Portable Net Graphics) is fully supported. Additionally icons should either be 16x16 or 32x32 otherwise you risk not having your images display.

To add a custom UI part start adding the XML declaration:

<?xml version="1.0" encoding="utf-8"?>

Next add the root element : customUI followed by the appropriate namespace for the version of Excel (See above). Remember to add the closing element.

<?xml version="1.0" encoding="utf-8"?>
<customUI xmlns="">


If you want to replace the default RibbonX in your Excel application, add the following property and set its value to true, otherwise set it to false or omit it to add to the current RibbonX.
<ribbon startFromScratch="true"/>

Within this root element you can either add a backstage as I mentioned above, tabs, tab



then add the <tab> element along with an id, label and insertAfterMso attribute. The insertAfterMso specifies where you want your tab to appear.

<tab id="Tools" label="Reporting" insertAfterMso="NameOfTab">

The next logical step is to add a group and then elements like buttons and images, dropdownlist to the group along with the action you want that element to execute.

<tab id="Tools" label="Reporting" insertAfterMso="NameOfTab"><group id="data" label="Get Data">
<button id="dataBtn" label="SQL" size="large" onAction="retrieveReportData" imageMso="DataViewDetailsView" />
<button id="reportBtn" label="Reports" size="large" onAction="chooseReport" imageMso="CreateReportInDesignView" />

If you are specify an Office image resource, use the imageMso attribute. If you using a custom image, use the image attribute. The easiest is to right click on your customUI file and select “add icons” or from the Insert menu.

The onAction attribute specifies what callback you want to execute in the Excel file. A callback is, simply put, a macro or a command that is or will be in your Excel file. The Custom UI Editor provides a way to automatically generate your callbacks (macros) as defined in each onAction attribute. Once you have defined the names of your callbacks, click on the Genrate Callback button in the menu and boilerplate method will be generated. You will need to copy the generated method stub to the Excel file and add code to the callback method using the VBA editor in Excel.

Generate a callback in the Custom UI Editor
Generate a callback in the Custom UI Editor
The boilersplate callback method
The boilersplate callback method
backstage in Excel
backstage in Excel

XML Sample Code

The Custom UI Editor comes with some sample XML code to help you get started.

Custom Outspace
The Outspace code tidbit is to create a new backstage tab (The backstage is the File menu in Excel 2010).

<?xml version="1.0" encoding="utf-8"?>
<customUI xmlns="">
		<tab id="customTab" label="Kevin BackStage">
				<taskGroup id="customTaskGroup" label="kevin">
					<category id="tgCategory1" label="Test">
						<task id="task1" label="Task 1" imageMso="FileOpen"/>
						<task id="task2" label="Task 2" imageMso="FileSave"/>
						<task id="task3" label="Task 3" imageMso="FileSaveAs"/>

Custom Tab

The Custom Tab code snippet creates a basic custom tab. It set the Tab name and group, adds a button and image set provides for a Callback method in the onAction attribute.

<customUI xmlns="">
	<ribbon startFromScratch="false">
			<tab id="customTab" label="Custom Tab">
				<group id="customGroup" label="Custom Group">
					<button id="customButton" label="Custom Button" imageMso="HappyFace" size="large" onAction="Callback" />

Excel - A Custom Tab

This sample provides the XML code for multiple groups within a Tab. You can also create multiple Tabs within this code as the following demonstrates:

<customUI xmlns="">
			<tab id="customTab" label="Contoso" insertAfterMso="TabHome">
				<group idMso="GroupClipboard" />
				<group idMso="GroupFont" />
				<group id="customGroup" label="Contoso Tools">
					<button id="customButton1" label="ConBold" size="large" onAction="conBoldSub" imageMso="Bold" />
					<button id="customButton2" label="ConItalic" size="large" onAction="conItalicSub" imageMso="Italic" />
					<button id="customButton3" label="ConUnderline" size="large" onAction="conUnderlineSub" imageMso="Underline" />
				<group idMso="GroupEnterDataAlignment" />
				<group idMso="GroupEnterDataNumber" />
				<group idMso="GroupQuickFormatting" />

			<tab id="KLcustomTab" label="Kevin" insertAfterMso="customTab">
				<group id="customGroup" label="KLanguedoc Tools">
					<button id="customButton1" label="So Something" size="large" onAction="DoSomething" imageMso="AdministrationHome" />
					<button id="customButton2" label="Callback" size="large" onAction="MyCallback" imageMso="AddInManager" />
					<button id="customButton3" label="Get Data" size="large" onAction="conUnderlineSub" imageMso="AccessListCustom" />


Word - Group on Insert Tab

This XML code as the name implies is for Word. The code is out of scope.


This code sample lets you modify the behavior of existing commands. The code below, the Bold command is disabled and a new Callback is defined for the Save. If you were to add this code to an Excel file and you clicked for instance on the Save command in the File menu, Excel would open the Developer Tab or if the Callback method “MySave” was included in the file, it would executed it instead of the regular Save command.

<customUI xmlns="">
		<command idMso="Bold" enabled="false"/>
		<command idMso="Save" onAction="MySave"/>

In Summary

RibbonX, although a little misunderstood in the beginning, is a powerful new way of organization commands in Microsoft Office.

For a complete list of elements for the RibbonX in either Microsoft 2007 or 2010 see the Resources below. This tutorial provides only a basic overview of the RibbonX control and how to modify it through XML. You can also use Microsoft Visual Studio to perform the same tasks and also to visually design your RibbonX. You can also export your custom RibbonX control through Visual Studio 2007 or 2010 as XML or as an dll for re distribution, resell or some other purpose.


These links are active at the time of this writing. If any are broken, do a search with your favorite search engine.

Office 2010 XML Reference

2007 Office System: XML Schema Reference Office 2010.
Office 2010 Icons Gallery
This is a word document that displays (See Backage or File Menu) all the icons and their names in

Office 2007 Icons Gallery

List of Control IDs (idMSO actions for built-in commands) for Office 2007

List of Controls as above for 2010


    0 of 8192 characters used
    Post Comment

    No comments yet.


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at:

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
    ClickscoThis is a data management platform studying reader behavior (Privacy Policy)