<

Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x

How to assign built-in Office icons to your VSTO Ribbon controls

Published on
18,354 Points
11,754 Views
1 Endorsement
Last Modified:
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon.

The tool is part of VSTO 2008 Power Tools.  The VSTO 2008 Power Tools can be downloaded from:
http://www.microsoft.com/downloads/details.aspx?FamilyId=46B6BF86-E35D-4870-B214-4D7B72B02BF9&displaylang=en
 
The VSTO_PTRibbonIDs.exe installs the Ribbon IDs Tool Window.  After installation, a new "ImageMso Window" item is added on the Tools menu of VS2008 as shown in figure 1.
 VS2008 Tools menuFigure 1. VS2008 Tools menu.

To assign the built-in Office icons to the ribbon button, follow these steps:

1.  On the ribbon designer, select an existing button, or create a new one by dragging it from the toolbox to the ribbon.

2.  On the VS2008 Tools menu, click "ImageMso Window" to display "Image Mso" dialog box.  The dialog box will look like figure 2.
Initial Mso dialog boxFigure 2. Initial Mso dialog box.

3.  In the tool window, type "saveas" in the search box, and click the magnifying glass.  The window will change to show just the related icons (see figure 3) .

VSTO Ribbon IDs Tool WindowFigure 3. VSTO Ribbon IDs Tool Window showing the search results for save.

4.  Any buttons that contains the word "saveas" in the id name will be displayed.  Notice that if you hover over a button, the tool tip shows you the imageMso ID.

5.  Click on the desired image--the tool copies the imageMso ID to the clipboard.

6.  Go to the button property windows and set the value of OfficeImageId by pasting the ID from the clipboard. (See figure 4)

save as button propertiesFigure 4. Ribbon Button property window with the assigned value.

The button now has the specified standard Office icon image.  Notice that you can not see this image at design time--only at run-time.  As an alternative to steps 5 and 6, you can drag-and-drop to copy the imageMso ID from a button to the property windows.  The actual drop target can be text-based source file in Visual Studio (such as your ribbon XML if you're not using the VSTO ribbon designer).

Notice that some Office images have multiple image sizes (32x32, 24x24 and 16x16).  This tool renders all images in either 32x32, or 16x16 format, regardless of the original size of the native image.

For more details you can read the VSTO Power Tools documentation that is part of the download mentioned above.

This tutorial applies to MS Office version 2007 and MS VS2008 (SP1).
1
Comment
Author:Miguel Oz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
0 Comments

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Join & Write a Comment

This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month