Custom ribbons

Create a custom ribbon that travels with your document


Since Office 2007 the main navigation is done by the ribbon. When deploying your own documents with macro's, sometimes it is useful to create your own ribbon. This tutorial will explain how.


When deploying Microsoft Office templates, often there are macros involved. Users want a user friendly way to access these macros. Typically this is done through a custom Ribbon. Goal of this tutorial is to learn how to create a custom ribbon that travels with your templates: the ribbon is only shown when the document is used. The tutorial will also show how a custom ribbons can be used to enable macros in self made add-ins.


Developers deploying Office templates with macros


In order to complete the tutorial you need to have a personal Computer running Microsoft Office 2007 or later (2010 or 2013). This usually implies running Windows 7 or Windows 8.

You need to be able to install some basic programs, sometimes with Admin privileges. However, some tools can be installed without the need to interfere with Windows. Have a look at the platform for instance.

Required knowledge

As this tutorial is aimed at developers deploying Microsoft Office documents containing macros, it is assumed you have some developer skills in general. Furthermore you need knowledge about:

  • Basic XML
  • Office 2010 (basics)
  • Microsoft's macro language in Office : Visual Basic for Applications (VBA, basic)
  • Windows basic Command line scripts (.cmd-file)

Some operations require you to run Windows commands from the so called Windows command line. These operations are quite simple and well documented in this tutorial.�

Altough this tutorial does not require you to add new VBA code, it is required that you at least know how to search for a Sub or Function.

Required tools

When choosing your XML editor, have a look at the possibilities. As we will setup XML files from scratch, it can be very tedious to find errors in your XML. Some XML editors like Altova XML Spy try some basic validation, or enable you to easily find errors.

I personally prefer 7Zip because it handles a lot of archive formats and it is free. The tutorial will use Word 2010 as the example platform, as it is most often used for templates.


There are some tools available that will handle adding a custom Ribbon to your documents. Some tools give you nice interfaces, some only allow you to add the Ribbon XML file. If these tools work for you, then probably this tutorial is not aimed at you. However, feel free to have a look at the information regarding setting up your Ribbon XML or how to create an interactive Ribbon.�

Tutorial lessons

This tutorial exists of a number of lessons which must be followed in order to reach the desired effect. Please review each step by clicking on the title

1 - Introduction to the Open XML Format

Getting to know the Open Document Format
You now have some basic knowledge of how an Office document is internally structured. Next step is to make some changes.

2 - Unpacking your document

Unpacking the Office document to reveal the files directories inside.
In the previous lesson we saw that an Office document is merely a zipped file containing files and folders. In this lesson we saw that the content of an Office document is a collection of zipped files.

3 - A closer look at the ribbon

In this lesson we will explore the Ribbon to get better understanding of the terms used in the Ribbon XML.
You now know how the ribbon is organized. The topmost level are the tabs. These tabs are organized in groups. Each group can have one or more buttons.

4 - Create a Ribbon XML

Create a basic Ribbon XML file
We learned in this lesson how to create a ribbon XML file, containing a Tab, tabgroup and some buttons.