<

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

Published on
19,069 Points
12,469 Views
1 Endorsement
Last Modified:
Approved
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
0 Comments

Featured Post

Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

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…
From store locators to asset tracking and route optimization, learn how leading companies are using Google Maps APIs throughout the customer journey to increase checkout conversions, boost user engagement, and optimize order fulfillment. Powered …

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month