Creating Your Very Own Office 2007 Ribbon - No Programming Necessary!Published on 18 Sep 2009
Tags #Access Infrastructure #Excel #InstantRibbonChanger #Office 2007 #PowerPoint #Word
The famous German IT magazine c’t has recently published an article about creating your own and modifying existing ribbons in Office 2007. Not again, you may be thinking. But the article shows how a simple DLL helps without any knowledge of programming.
Building or modifying an Office 2007 ribbon usually involves programming a DLL and defining a ribbon inside. This is an awful hassle considering that its basically just moving some buttons around. (I am fully aware that its not that easy!)
Two German programmers have taken upon themselves the task of making life easier for you, ribbon creators. On their homepage, they offer the InstantRibbonChanger (beware, it’s all in German). After registering the DLL, an INI containing XML-formatted data allows the following actions:
- Adding new ribbons
- Placing existing controls on new and existing ribbons
- Hiding controls in existing ribbons
- Customizing the presentation of controls
- Defining your own keyboard shortcuts
For all these tasks, you will need to know the internal names of all the controls available in Office 2007. Fortunately, Microsoft lists then in several Excel files available here. In addition, an online book about programming Access describes all the attributes available to controls (sorry, German again).
In the following sections, I’d like to offer some examples to get you started. All examples apply to Word only.
General structure of the INI file
The INI file allows for separate sections for all Office products. I have tested this for Word, Excel and PowerPoint so far.
[Word] <?xml version="1.0" encoding="iso-8859-1"?> <customUI xmlns="<a href="http://schemas.microsoft.com/office/2006/01/customui%22">http://schemas.microsoft.com/office/2006/01/customui"</a>> <ribbon> <tabs> <!-- all your stuff goes here --> </tabs> </ribbon> </customUI>
In the following examples, I will leave out the whole XML structure and only show the stuff inside the tabs tag.
Creating an addition ribbon
The following ribbon is called Favorites, is displayed before the first tab and accessible by the shortcut ALT-O.
<tab id="MeinTab" insertBeforeMso="TabHome" label="Favorites" keytip="O"> <!-- more stuff goes here --> </tab>
Placing existing controls on this tab
Include the styles gallery in your new tab.
<tab id="MyTab" insertBeforeMso="TabHome" label="Favorites" keytip="O"> <group idMso="GroupStyles" /> </tab>
Creating a new group of controls
A group of controls is displayed with a box around them and usually contains controls of similar use.
<tab id="MyTab" insertBeforeMso="TabHome" label="Favorites" keytip="O"> <group id="GroupDokumente" label="Document"> <control idMso="FileProperties" showLabel="false" keytip="E" /> <control idMso="FileSaveAs" showLabel="false" keytip="S" /> <control idMso="FileSaveAsPdfOrXps" showLabel="false" keytip="X" /> <control idMso="FileAddDigitalSignature" showLabel="false" keytip="P" /> <control idMso="Undo" showLabel="false" keytip="U" /> <control idMso="RedoOrRepeat" showLabel="false" keytip="D" /> </group>
Creating a new group of buttons
A group of controls are displayed closely together and considered a single unit when it comes to layouting.
<tab id="MyTab" insertBeforeMso="TabHome" label="Favorites" keytip="O"> <group id="GruppeFormat" label="Format"> <buttonGroup id="ButtonsFontSize"> <control idMso="FontSizeIncrease" keytip="G" /> <control idMso="FontSizeDecrease" keytip="K" /> </buttonGroup> </group> </tab>