Modifying the Ribbon – Part 3

Here’s the previous parts to this:

Using Excel’s Images on Custom Ribbon Controls

In Part 2, we built the following custom group on a custom tab:

This time, we’ll replace all the happy face images with pictures from Excel’s native ribbon images. Once you know how, it’s actually relatively easy to state which image you want. You just replace the HappyFace portion of the imageMso tag with the name of the Excel control that we want to use. The first question that we’ll obviously need to settle, however, is “How do we get the name of the control?”

What you need to do is go into the Excel Options screen, (click the Office button, then Excel Options,) and click Customize. You’ll now see the list of all the items that you can add to your Quick Access Toolbar (QAT). If you’re a developer in prior versions of Excel, you’ll remember that you pretty much had to create a custom toolbar to work out what FaceID corresponded to what picture. The good news here, is that things are much easier. :)

Move your mouse over one of the menu items and hover it there. A screen tip will pop up, and you’ll find the MSO image name at the end of the string! A picture is shown below of the tool tip.

What I’ve done below is grab a few random imageMso’s and put them into the XML for the example we created at the end of part 2. (Reproduced above.) The group now looks like this:

The images were selected based only on the fact that I thought they looked interesting. That’s all. Remember that these images will only do what you program them too, as shown in Part 1 of this series.

The XML code to create this group is shown below. One final word of note here… the imageMso tag is again Case Sensitive! If you mess up the case, you get no image at all on your control. The ribbon does at least get created though, which is better than the case sensitivity issues that I told you about in Part 2.

  1. <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
  2. <ribbon startFromScratch="false">
  3. <tabs>
  4. <tab id = "customTab" label="Custom Tab" insertAfterMso="TabView">
  5. <group id="customGroup1" label="Custom Group 1">
  6. <button id="BigButton1" label="I'm #1!" onAction="CallControl" size="large" imageMso="CalculateSheet" />
  7. <button id="Button1" label="Button 1" onAction="CallControl" imageMso="ChartTypeAllInsertDialog" />
  8. <button id="Button2" label="Button 2" onAction="CallControl" imageMso="SheetBackground" />
  9. <button id="BigButton2" label="I'm #2!" onAction="CallControl" size="large" imageMso="HangulHanjaConversion" />
  10. <button id="Button4" label="Special Button 1" onAction="CallControl" imageMso="InkingStart" />
  11. <button id="Button5" label="Special Button 2" onAction="CallControl" imageMso="GetExternalDataFromAccess" />
  12. <button id="Button6" label="Special Button 3" onAction="CallControl" imageMso="OutlineSettings" />
  13. </group>
  14. </tab>
  15. </tabs>
  16. </ribbon>
  17. </customUI>

7 thoughts on “Modifying the Ribbon – Part 3

  1. hi,

    Thanks to ken. I made my work with the icons provided in the excel.But do i can’t add any new icon, custom made, to the imageMso list.That would make my work more apt

  2. Hi Satya,

    Thanks for the comment! What format did you save your new image in? I know that the RibbonX code will work with *.jpg and *.png images, but I’m not sure about others. I’ll try to find out and post back. :)

  3. My coder is working on a custom ribbon for my addin in PowerPoint 2007.

    Is there an easy way to fully customize the mouse-over pop-up text that appears when the user moves the mouse over the buttons in the ribbon?

    My coder says he doesn’t know how to do that, but it seems like there is something that can restrict what is visible in the mouse-over text pop-up?

  4. Hi Billy,

    You can customize the screentip attribute, although we don’t have nearly as much control over them as Microsoft does, unfortunately.

  5. you can also make changes in the Word.qat file. This is the XML file for the quick access toolbar.

    see
    LeerWiki

    Im still going to try making the complete old 2003 menu with your manuals, rgrds

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>