<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Office Development with Visual Studio : Norm Estabrook</title><link>http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx</link><description>Tags: Norm Estabrook</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Do Your Outlook UI Elements Need Counseling? - Get your Form Regions, Ribbons, and Task Panes Talking to Each Other Again (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/06/03/do-your-outlook-ui-elements-need-counseling-get-your-form-regions-ribbons-and-task-panes-talking-to-each-other-again-norm-estabrook.aspx</link><pubDate>Thu, 04 Jun 2009 01:30:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9693769</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9693769.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9693769</wfw:commentRss><description>&lt;p&gt;So you want to open a task pane by using a button on the Ribbon. You also want a form region that appears in an e-mail item to detect the state of a control on a custom task pane so that you can add or remove an option that appears in a Ribbon menu right? Ok, I completely made this scenario up. But at some point, somewhere along the way, you might say to yourself – how do I get to that gallery on my Ribbon from my task pane? or how do I enable the user to populate that combo box on the form region by selecting a control on the Ribbon? Well if that describes something that you are trying to do, then this post is for you. Let’s start with Ribbons. The other two (form regions and task panes) are bit more troublesome.&lt;/p&gt;  &lt;h4&gt;Ribbons&lt;/h4&gt;  &lt;p&gt;Ribbon controls are the easiest to access from other areas of your application. Assuming that your custom Ribbon is named &lt;em&gt;Ribbon1&lt;/em&gt;, here is what you do:&lt;/p&gt;  &lt;p align="left"&gt;&lt;span style="color: #2b91af"&gt;ThisRibbonCollection &lt;/span&gt;ribbonCollection =    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.Ribbons    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; [&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.Application.ActiveInspector()];    &lt;br /&gt;ribbonCollection.Ribbon1.comboBox1.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;;&lt;/p&gt;  &lt;p&gt;You can read more about this &lt;a href="http://msdn.microsoft.com/en-us/library/bb772088.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;Form Regions&lt;/h4&gt;  &lt;p&gt;For the VB folks, this is a snap. C# developers have to do a bit more work. That is because by default, in a C# project, the controls that you add to a form region are private. For each control that you want to access, you have to set the &lt;strong&gt;Modifiers&lt;/strong&gt; property of the control to &lt;strong&gt;Internal &lt;/strong&gt;or &lt;strong&gt;Public&lt;/strong&gt;. For example: &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/OutlookUICounselingGetyourFormRegionsRib_E1EA/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/OutlookUICounselingGetyourFormRegionsRib_E1EA/image_thumb.png" width="321" height="360" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can then add code to access the control. For example, assuming that your form region is named &lt;em&gt;FormRegion1&lt;/em&gt;, you could use the following code:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;WindowFormRegionCollection &lt;/span&gt;formRegions =
    &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.FormRegions
        [&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.Application.ActiveInspector()];
formRegions.FormRegion1.textBox1.Text = &lt;span style="color: #a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;;&lt;/pre&gt;

&lt;p&gt;You can read more about this &lt;a href="http://msdn.microsoft.com/en-us/library/bb772084.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Custom Task Panes&lt;/h4&gt;

&lt;p&gt;Controls on task panes require the same tweaks described for form regions above.&amp;#160; Here is an example of how to get to a button on a task pane. This example makes the following assumptions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The user control of the custom task pane is named &lt;em&gt;MyUserControl&lt;/em&gt;. &lt;/li&gt;

  &lt;li&gt;The task pane is named &lt;em&gt;myCustomTaskPane&lt;/em&gt; and it is declared as public in your code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;((&lt;span style="color: #2b91af"&gt;MyUserControl&lt;/span&gt;)&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.myCustomTaskPane.Control).button1.Text = &lt;span style="color: #a31515"&gt;&amp;quot;It Worked&amp;quot;&lt;/span&gt;;&lt;/p&gt;

&lt;p&gt;If have not yet created a custom task pane, see &lt;a href="http://msdn.microsoft.com/en-us/library/aa942846.aspx"&gt;this topic&lt;/a&gt; and it will all make sense.&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;As a side note, if you are adding custom task panes to Outlook Inspector windows, you have to write a bit of code to map each Inspector window with it’s own instance of a custom task pane. If you don’t do this mapping, you get all kinds of wacky issues.&amp;#160; For an example of how to do this, see the following &lt;a href="http://msdn.microsoft.com/en-us/library/bb296010.aspx"&gt;article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the sake of being thorough, here is an example of how you can access a task pane created by using the guidance in that &lt;a href="http://msdn.microsoft.com/en-us/library/bb296010.aspx"&gt;article&lt;/a&gt;.&amp;#160; &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;toggleButton1_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RibbonControlEventArgs &lt;/span&gt;e)
{
    Outlook.&lt;span style="color: #2b91af"&gt;Inspector &lt;/span&gt;inspector = (Outlook.&lt;span style="color: #2b91af"&gt;Inspector&lt;/span&gt;)e.Control.Context;
    &lt;span style="color: #2b91af"&gt;InspectorWrapper &lt;/span&gt;inspectorWrapper = &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.InspectorWrappers[inspector];
    &lt;span style="color: #2b91af"&gt;CustomTaskPane &lt;/span&gt;taskPane = inspectorWrapper.CustomTaskPane;
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(taskPane != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        taskPane.Visible = ((&lt;span style="color: #2b91af"&gt;RibbonToggleButton&lt;/span&gt;)sender).Checked;
        taskPane.DockPosition = Microsoft.Office.Core.&lt;span style="color: #2b91af"&gt;MsoCTPDockPosition&lt;/span&gt;.msoCTPDockPositionBottom;
        taskPane.Height = 475;
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Hope this helps!&lt;/p&gt;

&lt;p&gt;Norm E.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9693769" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/add-ins/default.aspx">add-ins</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category></item><item><title>Here is a Way to Get the ID of a Built-in Outlook Command Bar Menu (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/04/30/here-is-a-way-to-get-the-id-of-a-built-in-outlook-command-bar-menu-norm-estabrook.aspx</link><pubDate>Fri, 01 May 2009 00:09:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9581289</guid><dc:creator>VSTO Team</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9581289.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9581289</wfw:commentRss><description>&lt;p&gt;Recently, a &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/adee1998-d619-4667-b08c-5038d02c3a0b/?prof=required"&gt;forum poster&lt;/a&gt; asked us how he could add a submenu item to a built-in menu item in Outlook.&amp;#160; Note that these are not controls that appear on the Ribbon of an Outlook item, but rather the menus that drop down from the top of the Outlook Explorer such as the &lt;strong&gt;View&lt;/strong&gt; menu and the &lt;strong&gt;Tools&lt;/strong&gt; menu.&lt;/p&gt;  &lt;p&gt;So one way to do this (In fact the only way that I know of) is to use the example shown in the following MSDN topic - &lt;a href="http://msdn.microsoft.com/en-us/library/ms269110.aspx"&gt;How to: Add Custom Menus and Menu Items to Outlook&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;You can’t just use the example as is. You will need to add a line of code to get a handle to a built-in menu. The following example gets a handle to the &lt;strong&gt;Junk E-Mail&lt;/strong&gt; menu that appears off of the &lt;strong&gt;Actions&lt;/strong&gt; menu of the Outlook Explorer window.&lt;/p&gt;  &lt;p&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup &lt;/span&gt;junkEmailMenu = (Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application.ActiveExplorer().CommandBars.FindControl    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; (Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlPopup, &lt;strong&gt;31353&lt;/strong&gt;, missing, missing);&lt;/p&gt;  &lt;p&gt;Note the ID number shown in the second parameter to the FindControl method. How on earth did I know that the &lt;strong&gt;Junk E-Mail&lt;/strong&gt; menu is the &lt;strong&gt;31353&lt;/strong&gt; menu?&amp;#160; The answer is … Not very easily. In fact to obtain that ID, I wrote a small Outlook add-in that iterates through all menus in Outlook and prints out their corresponding codes.&amp;#160; I figured that I would share this with you in case you ever have a similar scenario.&lt;/p&gt;  &lt;p&gt;Two notes about the sample below: First - this is a C# example, so my apologies to VB’ers. Second - this example is meant to be used in a Visual Studio 2008 Outlook (2007 or 2003) add-in project.&amp;#160; These projects automatically include the appropriate using statements that enable you to use the prefix “Office” in place of “Microsoft.Office.Core” when referring to some objects etc.&lt;/p&gt;  &lt;p&gt;Ok. Here is the code:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ThisAddIn
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;private void &lt;/span&gt;ThisAddIn_Startup(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.&lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
    {
        Outlook.&lt;span style="color: #2b91af"&gt;Application &lt;/span&gt;app = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application;
        &lt;span style="color: green"&gt;//Create a new txt file to record controls' list

        &lt;/span&gt;System.IO.&lt;span style="color: #2b91af"&gt;StreamWriter &lt;/span&gt;sw = System.IO.&lt;span style="color: #2b91af"&gt;File&lt;/span&gt;.CreateText
            (&lt;span style="color: #a31515"&gt;@&amp;quot;C:\Outlook Menus.txt&amp;quot;&lt;/span&gt;);

        &lt;span style="color: green"&gt;//loop through Outlook ActiveExplorer CommandBars to get all CommandBars

        &lt;/span&gt;&lt;span style="color: blue"&gt;foreach &lt;/span&gt;(Office.&lt;span style="color: #2b91af"&gt;CommandBarControl &lt;/span&gt;cb &lt;span style="color: blue"&gt;in &lt;/span&gt;app.ActiveExplorer().CommandBars.ActiveMenuBar.Controls)
        {
            PrintMenuItems(cb, sw);
        }

        sw.Close();

    }

    &lt;span style="color: green"&gt;// Recursive method for printing menus and nested menus.
    // Either the menu is a commandbarpopup (contains submenus)
    // Or it is a commandbarbutton (contains no submenus)

    &lt;/span&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;PrintMenuItems(&lt;span style="color: blue"&gt;object &lt;/span&gt;menuItem, System.IO.&lt;span style="color: #2b91af"&gt;StreamWriter &lt;/span&gt;sw)
    {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;== &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color: green"&gt;// This is a menu bar popup control.
            &lt;/span&gt;sw.WriteLine((menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).Caption +
                &lt;span style="color: #a31515"&gt;&amp;quot;\t&amp;quot; &lt;/span&gt;+ (menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).Id.ToString());

            &lt;span style="color: blue"&gt;if &lt;/span&gt;((menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).accChildCount &amp;gt; 0)
            {
                &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;j = 1; j &amp;lt;= (menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).accChildCount; j++)
                {
                    PrintMenuItems((menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarPopup&lt;/span&gt;).get_accChild(j), sw);
                }
            }
        }
        &lt;span style="color: blue"&gt;else
        &lt;/span&gt;{
            &lt;span style="color: green"&gt;// Must be a command
            &lt;/span&gt;sw.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;\t&amp;quot; &lt;/span&gt;+ (menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarControl&lt;/span&gt;).Caption +
                &lt;span style="color: #a31515"&gt;&amp;quot;\t&amp;quot; &lt;/span&gt;+ (menuItem &lt;span style="color: blue"&gt;as &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarControl&lt;/span&gt;).Id.ToString());
        }

    }&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;

&lt;p&gt;Norm E.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9581289" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Command+bars/default.aspx">Command bars</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2003/default.aspx">Office 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/add-ins/default.aspx">add-ins</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category></item><item><title>Clearing Off Custom Menu Items in Word (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/04/14/clearing-off-custom-menu-items-in-word-norm-estabrook.aspx</link><pubDate>Tue, 14 Apr 2009 21:37:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9548974</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9548974.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9548974</wfw:commentRss><description>&lt;p&gt;Last month I posted &lt;a href="http://blogs.msdn.com/vsto/archive/2009/03/06/my-word-add-in-creates-duplicate-menu-items-make-it-stop-norm-estabrook.aspx"&gt;this article&lt;/a&gt; that described how to prevent your add-in from creating duplicate menu items in Word.&amp;#160; If you have been experimenting with customization contexts, you might have several menu items that appear when you right click a document. The article that I posted shows how to prevent this from happening for your users, but what about removing the items that appear in your instance of Word – the one that you use for testing? &lt;/p&gt;  &lt;p&gt;To clear those off, just add a bit of code to the startup event handler of any old Word add-in.&amp;#160; Set the customization context to each possible culprit (template, document, attached template etc.) and then call the &lt;strong&gt;Reset&lt;/strong&gt; method. Be sure to save the template or document after words.&amp;#160; &lt;/p&gt;  &lt;p&gt;Note - I wouldn’t recommend that you put this code into an add-in that you send out to users as this code will remove all customizations in each context (Even ones that your add-in has not created!).&amp;#160; However, it is a cool way to clear up left over menu items from the instance of Word that you use for testing.&lt;/p&gt;  &lt;p&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;ResetShortcutMenu()     &lt;br /&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CustomizationContext = myApplication.ActiveDocument;     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Reset();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.ActiveDocument.Save();     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CustomizationContext = myApplication.ActiveDocument.get_AttachedTemplate();     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Reset();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ((Word.&lt;span style="color: #2b91af"&gt;Template&lt;/span&gt;)myApplication.ActiveDocument.get_AttachedTemplate()).Save();     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CustomizationContext = customTemplate;     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Reset();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; customTemplate.Save();     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CustomizationContext = myApplication.NormalTemplate;     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Reset();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; myApplication.NormalTemplate.Save();     &lt;br /&gt;}&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9548974" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2003/default.aspx">Office 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+Object+Model/default.aspx">Word Object Model</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2003/default.aspx">Word 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category></item><item><title>My Word Add-In Creates Duplicate Menu Items. Make it Stop! (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/03/06/my-word-add-in-creates-duplicate-menu-items-make-it-stop-norm-estabrook.aspx</link><pubDate>Fri, 06 Mar 2009 20:33:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9463406</guid><dc:creator>VSTO Team</dc:creator><slash:comments>13</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9463406.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9463406</wfw:commentRss><description>&lt;p&gt;So I want my add-in to place a custom command into the shortcut menu. The shortcut menu is that cool menu that appears when you right-click a document. Great, so I read some articles in MSDN, write some code, run the add-in and voila there it is! I give it to my buddy, he is proud of my accomplishment and and installs my add-in.&amp;#160; Now he hates me because every time he opens up Word, a duplicate menu appears.&amp;#160; Where did I go wrong? &lt;/p&gt;  &lt;p&gt;Well actually, I didn’t do anything wrong.&amp;#160; It’s just that Word requires a little more attention when it comes to handling menus. I guess you can say that Word is a bit more “needy” than other Office applications. But being “higher maintenance” does not have to mean “higher maintenance costs”.&amp;#160; Hopefully this post will get your friend talking to you again.&lt;/p&gt;  &lt;h3&gt;My code&lt;/h3&gt;  &lt;p&gt;Here is the code that did not work for me.&amp;#160; BTW – I will paste in both &lt;font color="#808080"&gt;Visual Basic&lt;/font&gt; and &lt;font color="#808080"&gt;C#&lt;/font&gt; examples for this post.&lt;/p&gt;  &lt;p&gt;&lt;font color="#808080"&gt;[Visual Basic]&lt;/font&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Private &lt;/span&gt;MyApplication &lt;span style="color: blue"&gt;As &lt;/span&gt;Word.Application
&lt;span style="color: blue"&gt;Private WithEvents &lt;/span&gt;myControl &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.CommandBarButton

&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;ThisAddIn_Startup _
(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As Object&lt;/span&gt;, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;System.EventArgs) &lt;span style="color: blue"&gt;Handles Me&lt;/span&gt;.Startup

    MyApplication = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.Application
    AddMenuItem()

&lt;span style="color: blue"&gt;End Sub

Private Sub &lt;/span&gt;AddMenuItem()

    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;menuItem &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.MsoControlType = _
        Office.MsoControlType.msoControlButton

    myControl = &lt;span style="color: blue"&gt;CType&lt;/span&gt;(MyApplication.CommandBars(&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;).Controls.Add _
       (menuItem, 1, &lt;span style="color: blue"&gt;True&lt;/span&gt;), Office.CommandBarButton)

    myControl.Style = Office.MsoButtonStyle.msoButtonCaption
    myControl.Caption = &lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item&amp;quot;
    &lt;/span&gt;myControl.Tag = &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;

&lt;/span&gt;&lt;span style="color: blue"&gt;End Sub


Sub &lt;/span&gt;myControl_Click(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;Ctrl &lt;span style="color: blue"&gt;As &lt;/span&gt;Microsoft.Office.Core.CommandBarButton, _
                    &lt;span style="color: blue"&gt;ByRef &lt;/span&gt;CancelDefault &lt;span style="color: blue"&gt;As Boolean&lt;/span&gt;) &lt;span style="color: blue"&gt;Handles &lt;/span&gt;myControl.Click

    System.Windows.Forms.MessageBox.Show(&lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item clicked&amp;quot;&lt;/span&gt;)

&lt;span style="color: blue"&gt;End Sub&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[C#]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;Word.&lt;span style="color: #2b91af"&gt;Application &lt;/span&gt;myApplication;
&lt;span style="color: blue"&gt;private &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;myControl;

&lt;span style="color: blue"&gt;private void &lt;/span&gt;ThisAddIn_Startup(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.&lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
{
    myApplication = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application;
    AddMenuItem(); 
}
 
&lt;span style="color: blue"&gt;private void &lt;/span&gt;AddMenuItem()
{
   Office.&lt;span style="color: #2b91af"&gt;MsoControlType &lt;/span&gt;menuItem = 
        Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlButton;

    myControl = 
        (Office.&lt;span style="color: #2b91af"&gt;CommandBarButton&lt;/span&gt;)myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Controls.Add
        (menuItem,missing, missing, 1, &lt;span style="color: blue"&gt;true&lt;/span&gt;);

    myControl.Style = Office.&lt;span style="color: #2b91af"&gt;MsoButtonStyle&lt;/span&gt;.msoButtonCaption;
    myControl.Caption = &lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item&amp;quot;&lt;/span&gt;;
    myControl.Tag = &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;&lt;/span&gt;;

    myControl.Click += 
        &lt;span style="color: blue"&gt;new &lt;/span&gt;Microsoft.Office.Core.&lt;span style="color: #2b91af"&gt;_CommandBarButtonEvents_ClickEventHandler
            &lt;/span&gt;(myControl_Click);

}

&lt;span style="color: blue"&gt;void &lt;/span&gt;myControl_Click(Microsoft.Office.Core.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;Ctrl, 
    &lt;span style="color: blue"&gt;ref bool &lt;/span&gt;CancelDefault)
{
    System.Windows.Forms.&lt;span style="color: #2b91af"&gt;MessageBox&lt;/span&gt;.Show(&lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item clicked&amp;quot;&lt;/span&gt;);
}&lt;/pre&gt;

&lt;h3&gt;Why my code does not work as expected&lt;/h3&gt;

&lt;p&gt;Here is one issue I can see right off the bat. Note this line of code for adding a control:&lt;/p&gt;

&lt;p&gt;myControl = &lt;span style="color: blue"&gt;CType&lt;/span&gt;(MyApplication.CommandBars(&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;).Controls.Add _ (menuItem, 1, &lt;span style="color: blue"&gt;True&lt;/span&gt;), Office.CommandBarButton) &lt;/p&gt;

&lt;p&gt;I set the last parameter of the &lt;strong&gt;Add &lt;/strong&gt;method to &lt;strong&gt;True&lt;/strong&gt;.&amp;#160; This value specifies that I want my control to be temporary. I am trying to tell Word &lt;strong&gt;not&lt;/strong&gt; to save the control so that duplicate menu items won’t be added every time Word opens.&amp;#160; Only there is a problem here.&amp;#160; Word &lt;strong&gt;ignores&lt;/strong&gt; this parameter (at least for controls in a CommandBar collection anyway). So I can keep it set to &lt;strong&gt;true&lt;/strong&gt;, but it really means &lt;strong&gt;false&lt;/strong&gt;. Lovely.&lt;/p&gt;

&lt;p&gt;So what is happening? Well, Word is actually saving your new menu command to the Normal.dot template every time a new instance of Word opens – hence the duplicates.&lt;/p&gt;

&lt;h3&gt;What can I do about this?&lt;/h3&gt;

&lt;p&gt;There are probably a billion creative ways to stop the duplicate menus from appearing, but here are &lt;u&gt;three&lt;/u&gt; tips that work really well. Here they are:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Check for duplicates &lt;strong&gt;before &lt;/strong&gt;adding an item (control) to a menu. &lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;Always&lt;/strong&gt; set the customization context of the application to the same document or template before adding or deleting a control. &lt;/li&gt;

  &lt;li&gt;Because there are no temporary commands in Word, &lt;strong&gt;use a custom template&lt;/strong&gt; to save the commands. &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Tip # 1: Check for Duplicates:&lt;/h4&gt;

&lt;p&gt;This one is pretty easy.&amp;#160; Just add code to your add-in that looks for a control that has the same &lt;strong&gt;tag&lt;/strong&gt; as the control you are about to add.&amp;#160; If one exists, perform one of the following actions:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Don’t add the control (It is already there). &lt;/li&gt;

  &lt;li&gt;Delete the control. Then you can add it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I modified my code to &lt;strong&gt;delete&lt;/strong&gt; the control. Here is my code.&lt;/p&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[Visual Basic]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;RemoveExistingMenuItem()

    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;contextMenu &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.CommandBar = _
    MyApplication.CommandBars(&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;)

    MyApplication.CustomizationContext = customTemplate

    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;control &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.CommandBarButton = contextMenu.FindControl _
        (Office.MsoControlType.msoControlButton, System.Type.Missing, _
         &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;True&lt;/span&gt;, &lt;span style="color: blue"&gt;True&lt;/span&gt;)

    &lt;span style="color: blue"&gt;If Not &lt;/span&gt;(control &lt;span style="color: blue"&gt;Is Nothing&lt;/span&gt;) &lt;span style="color: blue"&gt;Then
        &lt;/span&gt;control.Delete(&lt;span style="color: blue"&gt;True&lt;/span&gt;)
    &lt;span style="color: blue"&gt;End If

End Sub&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[C#]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;RemoveExistingMenuItem()
{
    Office.&lt;span style="color: #2b91af"&gt;CommandBar &lt;/span&gt;contextMenu = myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;];
    myApplication.CustomizationContext = customTemplate;

    Office.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;control = 
        (Office.&lt;span style="color: #2b91af"&gt;CommandBarButton&lt;/span&gt;)contextMenu.FindControl
        (Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlButton, missing,
        &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;true&lt;/span&gt;, &lt;span style="color: blue"&gt;true&lt;/span&gt;);

    &lt;span style="color: blue"&gt;if &lt;/span&gt;((control != &lt;span style="color: blue"&gt;null&lt;/span&gt;))
    {
        control.Delete(&lt;span style="color: blue"&gt;true&lt;/span&gt;);
    }

}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h4&gt;Tip #2: Set the Customization Context&lt;/h4&gt;

&lt;p&gt;The customization context of the application tells Word where to save your customizations. To specify the customization context, set the &lt;a href="http://msdn.microsoft.com/en-us/library/aa205536(office.10).aspx"&gt;CustomizationContext&lt;/a&gt; property of the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word._application(VS.80).aspx"&gt;Application&lt;/a&gt; object.&lt;/p&gt;

&lt;p&gt;By default, Word uses the &lt;strong&gt;Normal.dot&lt;/strong&gt; template as it’s customization context.&amp;#160; This is not reliable and can change. If you do not explicitly set the context, you might search for controls saved to one context such as a document, delete controls from another context such as a custom template and then add the control to another context such as Normal.dot.&lt;/p&gt;

&lt;p&gt;To avoid these issues, &lt;strong&gt;always &lt;/strong&gt;set the customization context of the application to the same document or template every time you search for, delete, or add controls to a menu.&lt;/p&gt;

&lt;p&gt;Note that in a Word document-level customization, it is probably best to set the customization context to the active document.&amp;#160; That way when the user uninstalls the customization, the document and the menu commands that pertain to that document disappear as expected.&lt;/p&gt;

&lt;p&gt;In Word application-level add-in, the best practice is to use a &lt;strong&gt;custom template&lt;/strong&gt; for reasons mentioned later on in this post.&lt;/p&gt;

&lt;p&gt;In the following example, I highlighted in bold the line that sets the customization context.&amp;#160; Further along in this post, I will show you where I got &lt;strong&gt;customTemplate&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[Visual Basic]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;AddMenuItem()

&lt;strong&gt;    &lt;font size="4"&gt;MyApplication.CustomizationContext = customTemplate&lt;/font&gt;&lt;/strong&gt;

    &lt;span style="color: blue"&gt;Dim &lt;/span&gt;menuItem &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.MsoControlType = _
        Office.MsoControlType.msoControlButton

    myControl = &lt;span style="color: blue"&gt;CType&lt;/span&gt;(MyApplication.CommandBars(&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;).Controls.Add _
       (menuItem, 1, &lt;span style="color: blue"&gt;True&lt;/span&gt;), Office.CommandBarButton)

    myControl.Style = Office.MsoButtonStyle.msoButtonCaption
    myControl.Caption = &lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item&amp;quot;
    &lt;/span&gt;myControl.Tag = &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;
    &lt;/span&gt;customTemplate.Saved = &lt;span style="color: blue"&gt;True
&lt;/span&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;    GC&lt;/span&gt;.Collect()
&lt;span style="color: blue"&gt;
End Sub&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[C#]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;AddMenuItem()
{
    &lt;font size="4"&gt;&lt;strong&gt;myApplication.CustomizationContext = customTemplate;&lt;/strong&gt;&lt;/font&gt;
    Office.&lt;span style="color: #2b91af"&gt;MsoControlType &lt;/span&gt;menuItem = 
        Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlButton;

    myControl = 
        (Office.&lt;span style="color: #2b91af"&gt;CommandBarButton&lt;/span&gt;)myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Controls.Add
        (menuItem,missing, missing, 1, &lt;span style="color: blue"&gt;true&lt;/span&gt;);

    myControl.Style = Office.&lt;span style="color: #2b91af"&gt;MsoButtonStyle&lt;/span&gt;.msoButtonCaption;
    myControl.Caption = &lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item&amp;quot;&lt;/span&gt;;
    myControl.Tag = &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;&lt;/span&gt;;

    myControl.Click += 
        &lt;span style="color: blue"&gt;new &lt;/span&gt;Microsoft.Office.Core.&lt;span style="color: #2b91af"&gt;_CommandBarButtonEvents_ClickEventHandler
            &lt;/span&gt;(myControl_Click);

    customTemplate.Saved = &lt;span style="color: blue"&gt;true&lt;/span&gt;;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;    GC&lt;/span&gt;.Collect();&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strong&gt;Also – a quick tip&lt;/strong&gt; – set the &lt;strong&gt;Saved&lt;/strong&gt; property of the template to &lt;strong&gt;true &lt;/strong&gt;after you add the control.&amp;#160; This stops that annoying prompt from appearing that asks if you would like to save your customizations to the template.&lt;/p&gt;

&lt;h4&gt;Tip #3: Use a Custom Template&lt;/h4&gt;

&lt;p&gt;It is very difficult to delete a control &lt;strong&gt;before&lt;/strong&gt; the add-in shuts down.&amp;#160; For example, if you attempt to delete a control in the &lt;strong&gt;ThisAddIn_Shutdown&lt;/strong&gt; event handler, you will receive a not so helpful COM exception.&amp;#160; You will get similar results in the &lt;strong&gt;Quit&lt;/strong&gt; event of Word.&amp;#160; &lt;/p&gt;

&lt;p&gt;That is because the template that you are using as your application’s customization context is not writable in either of those event handlers.&amp;#160; So if you cannot easily delete the control when Word closes, that means that the control will always live inside of the template.&lt;/p&gt;

&lt;p&gt;This is a problem if you are using Normal.dot to persist the controls.&amp;#160; Here is why.&amp;#160; Let’s say the user decides that he does not want to see your command in a menu anymore.&amp;#160; With a caption such as “My Menu Item”, can you really blame him? So the user uninstalls your add-in. However, the menu command still lives in Normal.dot! When that user opens his document in Word, &amp;quot;My Menu Item” still appears. Doooh! Here comes the support calls!&lt;/p&gt;

&lt;p&gt;The way around this is to provide your own custom template to store customizations such as custom menus and menu items.&amp;#160; Your setup application can remove the template along with add-in. That way when the user uninstalls the add-in, they also remove the template that contains the menu items. &lt;/p&gt;

&lt;p&gt;In the following example, I retrieve a custom template from the users documents folder. Yes, your setup application will probably use a different location to place the custom template, but this is just for an example.&lt;/p&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[Visual Basic]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;GetCustomTemplate()&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;    Dim &lt;/span&gt;TemplatePath &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.GetFolderPath _
        (&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;SpecialFolder&lt;/span&gt;.MyDocuments) + &lt;span style="color: #a31515"&gt;&amp;quot;\MyCustomTemplate.dotx&amp;quot;
&lt;/span&gt;&lt;span style="color: blue"&gt;    Dim &lt;/span&gt;install &lt;span style="color: blue"&gt;As Boolean &lt;/span&gt;= &lt;span style="color: blue"&gt;True

    For Each &lt;/span&gt;installedTemplate &lt;span style="color: blue"&gt;As &lt;/span&gt;Word.&lt;span style="color: #2b91af"&gt;Template &lt;/span&gt;&lt;span style="color: blue"&gt;In &lt;/span&gt;MyApplication.Templates
        &lt;span style="color: blue"&gt;If &lt;/span&gt;installedTemplate.FullName = &lt;span style="color: blue"&gt;DirectCast&lt;/span&gt;(TemplatePath, &lt;span style="color: blue"&gt;String&lt;/span&gt;) &lt;span style="color: blue"&gt;Then
            &lt;/span&gt;install = &lt;span style="color: blue"&gt;False
&lt;/span&gt;        &lt;span style="color: blue"&gt;End If
    Next

    If &lt;/span&gt;install = &lt;span style="color: blue"&gt;True Then
        &lt;/span&gt;MyApplication.AddIns.Add(TemplatePath.ToString(), &lt;span style="color: blue"&gt;True&lt;/span&gt;)
&lt;span style="color: blue"&gt;    End If

&lt;/span&gt;    customTemplate = MyApplication.Templates(TemplatePath)&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;End Sub&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[C#]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;GetCustomTemplate()
{
    &lt;span style="color: blue"&gt;object &lt;/span&gt;TemplatePath = &lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.GetFolderPath
        (&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;SpecialFolder&lt;/span&gt;.MyDocuments) +
        &lt;span style="color: #a31515"&gt;&amp;quot;\\MyCustomTemplate.dotx&amp;quot;&lt;/span&gt;;
    &lt;span style="color: blue"&gt;object &lt;/span&gt;install = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
    &lt;/pre&gt;

&lt;pre class="code"&gt;    &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(Word.&lt;span style="color: #2b91af"&gt;Template &lt;/span&gt;installedTemplate &lt;span style="color: blue"&gt;in &lt;/span&gt;myApplication.Templates)
    {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(installedTemplate.FullName == (&lt;span style="color: blue"&gt;string&lt;/span&gt;)TemplatePath)
        {
            install = &lt;span style="color: blue"&gt;false&lt;/span&gt;;
        }
    }
    &lt;span style="color: blue"&gt;if &lt;/span&gt;((&lt;span style="color: blue"&gt;bool&lt;/span&gt;)install)
    {
        myApplication.AddIns.Add(TemplatePath.ToString(), &lt;span style="color: blue"&gt;ref &lt;/span&gt;install);
    }
    customTemplate = myApplication.Templates.get_Item(&lt;span style="color: blue"&gt;ref &lt;/span&gt;TemplatePath);

}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;h4&gt;&lt;font color="#808080"&gt;&lt;font color="#000000"&gt;Drum roll please .. I present the complete example&lt;/font&gt;&lt;/font&gt;&lt;/h4&gt;

&lt;p&gt;To provide context, here is the complete sample:&lt;/p&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[Visual Basic]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Public Class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ThisAddIn

    &lt;/span&gt;&lt;span style="color: blue"&gt;Private &lt;/span&gt;MyApplication &lt;span style="color: blue"&gt;As &lt;/span&gt;Word.Application
    &lt;span style="color: blue"&gt;Private WithEvents &lt;/span&gt;myControl &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarButton
    &lt;/span&gt;&lt;span style="color: blue"&gt;Private &lt;/span&gt;customTemplate &lt;span style="color: blue"&gt;As &lt;/span&gt;Word.&lt;span style="color: #2b91af"&gt;Template

    &lt;/span&gt;&lt;span style="color: blue"&gt;Private Sub &lt;/span&gt;ThisAddIn_Startup _
    (&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;sender &lt;span style="color: blue"&gt;As Object&lt;/span&gt;, &lt;span style="color: blue"&gt;ByVal &lt;/span&gt;e &lt;span style="color: blue"&gt;As &lt;/span&gt;System.&lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt;) &lt;span style="color: blue"&gt;Handles Me&lt;/span&gt;.Startup

        MyApplication = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.Application

        GetCustomTemplate()
        RemoveExistingMenuItem()
        AddMenuItem()

    &lt;span style="color: blue"&gt;End Sub

    Private Sub &lt;/span&gt;GetCustomTemplate()
        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;TemplatePath &lt;span style="color: blue"&gt;As String &lt;/span&gt;= &lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.GetFolderPath _
            (&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;SpecialFolder&lt;/span&gt;.MyDocuments) + &lt;span style="color: #a31515"&gt;&amp;quot;\MyCustomTemplate.dotx&amp;quot;
        &lt;/span&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;install &lt;span style="color: blue"&gt;As Boolean &lt;/span&gt;= &lt;span style="color: blue"&gt;True

        For Each &lt;/span&gt;installedTemplate &lt;span style="color: blue"&gt;As &lt;/span&gt;Word.&lt;span style="color: #2b91af"&gt;Template &lt;/span&gt;&lt;span style="color: blue"&gt;In &lt;/span&gt;MyApplication.Templates
            &lt;span style="color: blue"&gt;If &lt;/span&gt;installedTemplate.FullName = &lt;span style="color: blue"&gt;DirectCast&lt;/span&gt;(TemplatePath, &lt;span style="color: blue"&gt;String&lt;/span&gt;) &lt;span style="color: blue"&gt;Then
                &lt;/span&gt;install = &lt;span style="color: blue"&gt;False
            End If
        Next

        If &lt;/span&gt;install = &lt;span style="color: blue"&gt;True Then
            &lt;/span&gt;MyApplication.AddIns.Add(TemplatePath.ToString(), &lt;span style="color: blue"&gt;True&lt;/span&gt;)
        &lt;span style="color: blue"&gt;End If

        &lt;/span&gt;customTemplate = MyApplication.Templates(TemplatePath)

    &lt;span style="color: blue"&gt;End Sub

    Private Sub &lt;/span&gt;RemoveExistingMenuItem()

        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;contextMenu &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBar &lt;/span&gt;= _
        MyApplication.CommandBars(&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;)

        MyApplication.CustomizationContext = customTemplate

        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;control &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;= contextMenu.FindControl _
            (Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlButton, System.&lt;span style="color: #2b91af"&gt;Type&lt;/span&gt;.Missing, _
             &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;True&lt;/span&gt;, &lt;span style="color: blue"&gt;True&lt;/span&gt;)

        &lt;span style="color: blue"&gt;If Not &lt;/span&gt;(control &lt;span style="color: blue"&gt;Is Nothing&lt;/span&gt;) &lt;span style="color: blue"&gt;Then
            &lt;/span&gt;control.Delete(&lt;span style="color: blue"&gt;True&lt;/span&gt;)
        &lt;span style="color: blue"&gt;End If

    End Sub


    Private Sub &lt;/span&gt;AddMenuItem()

        MyApplication.CustomizationContext = customTemplate

        &lt;span style="color: blue"&gt;Dim &lt;/span&gt;menuItem &lt;span style="color: blue"&gt;As &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;MsoControlType &lt;/span&gt;= _
            Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlButton

        myControl = &lt;span style="color: blue"&gt;CType&lt;/span&gt;(MyApplication.CommandBars(&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;).Controls.Add _
           (menuItem, 1, &lt;span style="color: blue"&gt;True&lt;/span&gt;), Office.&lt;span style="color: #2b91af"&gt;CommandBarButton&lt;/span&gt;)

        myControl.Style = Office.&lt;span style="color: #2b91af"&gt;MsoButtonStyle&lt;/span&gt;.msoButtonCaption
        myControl.Caption = &lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item&amp;quot;
        &lt;/span&gt;myControl.Tag = &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;
        &lt;/span&gt;customTemplate.Saved = &lt;span style="color: blue"&gt;True

        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GC&lt;/span&gt;.Collect()

    &lt;span style="color: blue"&gt;End Sub

    Sub &lt;/span&gt;myControl_Click(&lt;span style="color: blue"&gt;ByVal &lt;/span&gt;Ctrl &lt;span style="color: blue"&gt;As &lt;/span&gt;Microsoft.Office.Core.&lt;span style="color: #2b91af"&gt;CommandBarButton&lt;/span&gt;, _
                        &lt;span style="color: blue"&gt;ByRef &lt;/span&gt;CancelDefault &lt;span style="color: blue"&gt;As Boolean&lt;/span&gt;) &lt;span style="color: blue"&gt;Handles &lt;/span&gt;myControl.Click

        System.Windows.Forms.&lt;span style="color: #2b91af"&gt;MessageBox&lt;/span&gt;.Show(&lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item clicked&amp;quot;&lt;/span&gt;)

    &lt;span style="color: blue"&gt;End Sub

    Private Sub &lt;/span&gt;ThisAddIn_Shutdown() &lt;span style="color: blue"&gt;Handles Me&lt;/span&gt;.Shutdown

    &lt;span style="color: blue"&gt;End Sub

End Class
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;font color="#808080"&gt;[C#]&lt;/font&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ThisAddIn
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;private &lt;/span&gt;Word.&lt;span style="color: #2b91af"&gt;Application &lt;/span&gt;myApplication;
    &lt;span style="color: blue"&gt;private &lt;/span&gt;Office.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;myControl;
    &lt;span style="color: blue"&gt;private &lt;/span&gt;Word.&lt;span style="color: #2b91af"&gt;Template &lt;/span&gt;customTemplate;

    &lt;span style="color: blue"&gt;private void &lt;/span&gt;ThisAddIn_Startup(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.&lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
    {
        myApplication = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application;

        GetCustomTemplate();
        RemoveExistingMenuItem();
        AddMenuItem();
    }

    &lt;span style="color: blue"&gt;private void &lt;/span&gt;GetCustomTemplate()
    {
        &lt;span style="color: blue"&gt;object &lt;/span&gt;TemplatePath = &lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.GetFolderPath
            (&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.&lt;span style="color: #2b91af"&gt;SpecialFolder&lt;/span&gt;.MyDocuments) +
            &lt;span style="color: #a31515"&gt;&amp;quot;\\MyCustomTemplate.dotx&amp;quot;&lt;/span&gt;;
        &lt;span style="color: blue"&gt;object &lt;/span&gt;install = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(Word.&lt;span style="color: #2b91af"&gt;Template &lt;/span&gt;installedTemplate &lt;span style="color: blue"&gt;in &lt;/span&gt;myApplication.Templates)
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(installedTemplate.FullName == (&lt;span style="color: blue"&gt;string&lt;/span&gt;)TemplatePath)
            {
                install = &lt;span style="color: blue"&gt;false&lt;/span&gt;;
            }
        }
        &lt;span style="color: blue"&gt;if &lt;/span&gt;((&lt;span style="color: blue"&gt;bool&lt;/span&gt;)install)
        {
            myApplication.AddIns.Add(TemplatePath.ToString(), &lt;span style="color: blue"&gt;ref &lt;/span&gt;install);
        }
        customTemplate = myApplication.Templates.get_Item(&lt;span style="color: blue"&gt;ref &lt;/span&gt;TemplatePath);

    }

    &lt;span style="color: blue"&gt;private void &lt;/span&gt;RemoveExistingMenuItem()
    {
        Office.&lt;span style="color: #2b91af"&gt;CommandBar &lt;/span&gt;contextMenu = myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;];
        myApplication.CustomizationContext = customTemplate;

        Office.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;control =
            (Office.&lt;span style="color: #2b91af"&gt;CommandBarButton&lt;/span&gt;)contextMenu.FindControl
            (Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlButton, missing,
            &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;true&lt;/span&gt;, &lt;span style="color: blue"&gt;true&lt;/span&gt;);

        &lt;span style="color: blue"&gt;if &lt;/span&gt;((control != &lt;span style="color: blue"&gt;null&lt;/span&gt;))
        {
            control.Delete(&lt;span style="color: blue"&gt;true&lt;/span&gt;);
        }

    }

    &lt;span style="color: blue"&gt;private void &lt;/span&gt;AddMenuItem()
    {
        myApplication.CustomizationContext = customTemplate;
        Office.&lt;span style="color: #2b91af"&gt;MsoControlType &lt;/span&gt;menuItem =
            Office.&lt;span style="color: #2b91af"&gt;MsoControlType&lt;/span&gt;.msoControlButton;

        myControl =
            (Office.&lt;span style="color: #2b91af"&gt;CommandBarButton&lt;/span&gt;)myApplication.CommandBars[&lt;span style="color: #a31515"&gt;&amp;quot;Text&amp;quot;&lt;/span&gt;].Controls.Add
            (menuItem, missing, missing, 1, &lt;span style="color: blue"&gt;true&lt;/span&gt;);

        myControl.Style = Office.&lt;span style="color: #2b91af"&gt;MsoButtonStyle&lt;/span&gt;.msoButtonCaption;
        myControl.Caption = &lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item&amp;quot;&lt;/span&gt;;
        myControl.Tag = &lt;span style="color: #a31515"&gt;&amp;quot;MyMenuItem&amp;quot;&lt;/span&gt;;

        myControl.Click +=
            &lt;span style="color: blue"&gt;new &lt;/span&gt;Microsoft.Office.Core.&lt;span style="color: #2b91af"&gt;_CommandBarButtonEvents_ClickEventHandler
                &lt;/span&gt;(myControl_Click);

        customTemplate.Saved = &lt;span style="color: blue"&gt;true&lt;/span&gt;;

        &lt;span style="color: #2b91af"&gt;GC&lt;/span&gt;.Collect();

    }

    &lt;span style="color: blue"&gt;void &lt;/span&gt;myControl_Click(Microsoft.Office.Core.&lt;span style="color: #2b91af"&gt;CommandBarButton &lt;/span&gt;Ctrl,
        &lt;span style="color: blue"&gt;ref bool &lt;/span&gt;CancelDefault)
    {
        System.Windows.Forms.&lt;span style="color: #2b91af"&gt;MessageBox&lt;/span&gt;.Show(&lt;span style="color: #a31515"&gt;&amp;quot;My Menu Item clicked&amp;quot;&lt;/span&gt;);
    }
    &lt;span style="color: blue"&gt;private void &lt;/span&gt;ThisAddIn_Shutdown(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.&lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
    {
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Now you can issue a patch to your buddy so that he has only one “My Menu Item” appearing in his shortcut menu.&amp;#160; Although .. I am not sure what “My Menu Item” is really suppose to do … 

&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9463406" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Command+bars/default.aspx">Command bars</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2003/default.aspx">Office 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Word+2003/default.aspx">Word 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/add-ins/default.aspx">add-ins</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+14/default.aspx">Office 14</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2010/default.aspx">Office 2010</category></item><item><title>Making a Custom Ribbon Appear Only for a Custom Outlook Form (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2009/01/28/making-a-custom-ribbon-appear-only-for-a-custom-outlook-form.aspx</link><pubDate>Wed, 28 Jan 2009 23:09:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9381689</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9381689.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9381689</wfw:commentRss><description>&lt;p&gt;Many of you have posted questions to the &lt;a href="http://social.msdn.microsoft.com/forums/en-US/vsto/threads/"&gt;VSTO Forum&lt;/a&gt; about how to make custom tabs, groups and controls appear only in cases where the user opens a custom form in Outlook. &lt;/p&gt;  &lt;p&gt;The reason why that is difficult to accomplish is because there is no way to specify the names of custom forms in the Ribbon Designer. You can only specify inspector window types.&lt;/p&gt;  &lt;p&gt;So if I set the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.officeribbon.ribbontype.aspx"&gt;RibbonType&lt;/a&gt; property of the Ribbon to “Microsoft.Outlook.Mail.Compose”,&amp;#160; then the Ribbon controls appear for all new mail items &lt;strong&gt;including&lt;/strong&gt; items that I create by using a custom mail form. So how can I make sure that the Ribbon controls only appear in my custom mail form? &lt;/p&gt;  &lt;p&gt;One possible workaround is to show and hide controls based on the message class of an Outlook form. It seemed to work for me and here is how I did it.&lt;/p&gt;  &lt;p&gt;In the Ribbon designer, set the &lt;strong&gt;Visible&lt;/strong&gt; property of your custom controls to false. At this point, those controls will not appear in any Outlook form custom or otherwise.&lt;/p&gt;  &lt;p&gt;Next, add a property to the ThisAddIn class that stores the name of a custom message class as follows:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private string &lt;/span&gt;strMessageClass = &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;
&lt;span style="color: blue"&gt;public string &lt;/span&gt;MessageClass
{
    &lt;span style="color: blue"&gt;get
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;return &lt;/span&gt;strMessageClass;
    }
    &lt;span style="color: blue"&gt;set
    &lt;/span&gt;{
        strMessageClass = &lt;span style="color: blue"&gt;value&lt;/span&gt;;
    }
}&lt;/pre&gt;

&lt;p&gt;Create an event handler for the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspectorsevents_newinspectoreventhandler.aspx"&gt;NewInspector&lt;/a&gt; event. This event is raised every time a new Outlook inspector is open. The item that opens in the inspector has a message class name. For example, if you open a standard mail item, the message class name of the item is “IPM.Note”. A custom form based on a standard email form might have the message class name “IPM.Note.MyCustomForm”.&lt;/p&gt;

&lt;p&gt;In the event handler, set your custom string property to the message class name of the open item. Here is an example:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;Outlook.&lt;span style="color: #2b91af"&gt;Inspectors &lt;/span&gt;inspectors;
&lt;span style="color: blue"&gt;private void &lt;/span&gt;ThisAddIn_Startup(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.&lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
{
    inspectors = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application.Inspectors;
    inspectors.NewInspector +=
        &lt;span style="color: blue"&gt;new &lt;/span&gt;Microsoft.Office.Interop.Outlook.&lt;span style="color: #2b91af"&gt;InspectorsEvents_NewInspectorEventHandler
            &lt;/span&gt;(Inspectors_NewInspector);

}

&lt;span style="color: blue"&gt;void &lt;/span&gt;Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.&lt;span style="color: #2b91af"&gt;Inspector &lt;/span&gt;Inspector)
{
    Outlook.&lt;span style="color: #2b91af"&gt;MailItem &lt;/span&gt;tmpMailItem = (Outlook.&lt;span style="color: #2b91af"&gt;MailItem&lt;/span&gt;)Inspector.CurrentItem;
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(tmpMailItem != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        MessageClass = tmpMailItem.MessageClass;
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;In the load event of your Ribbon class, check your custom string property to determine the message class of the item that is attempting to load your custom Ribbon. If the name matches the name of your custom message class, you can show the controls on your custom Ribbon. Here is an example:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Ribbon1_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RibbonUIEventArgs &lt;/span&gt;e)
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.MessageClass == &lt;span style="color: #a31515"&gt;&amp;quot;IPM.Note.Norm&amp;quot;&lt;/span&gt;)
    {
        group1.Visible = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.ThisAddIn.MessageClass = &lt;span style="color: #a31515"&gt;&amp;quot;&amp;quot;&lt;/span&gt;;
    }
    

}&lt;/pre&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9381689" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category></item><item><title>Setting the Width of a Drop Down, Combo Box, or Edit Box in the Ribbon Designer (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2008/12/19/setting-the-width-of-a-drop-down-combo-box-or-edit-box-in-the-ribbon-designer.aspx</link><pubDate>Fri, 19 Dec 2008 21:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9242650</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9242650.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9242650</wfw:commentRss><description>&lt;P&gt;Recently, a developer posted a question to the &lt;A href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1018&amp;amp;SiteID=1" mce_href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=1018&amp;amp;SiteID=1"&gt;VSTO forum&lt;/A&gt; asking us how to set the width of a drop down control by using the Ribbon Designer (&lt;A href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/8965ae5a-9c02-4aec-9178-675650b7044e/" mce_href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/8965ae5a-9c02-4aec-9178-675650b7044e/"&gt;http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/8965ae5a-9c02-4aec-9178-675650b7044e/&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;As this person experienced, if you do not set the width of the control, the text that appears in a drop down, combo box, or edit box will truncate. For example, the string “I love Visual Studio Tools for Office!” is truncated in the following drop down:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/SettingtheWidthofaDropDownComboBoxorEdit_99C4/clip_image002_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/SettingtheWidthofaDropDownComboBoxorEdit_99C4/clip_image002_2.jpg"&gt;&lt;IMG title=clip_image002 style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; DISPLAY: inline; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=191 alt=clip_image002 src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/SettingtheWidthofaDropDownComboBoxorEdit_99C4/clip_image002_thumb.jpg" width=238 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/SettingtheWidthofaDropDownComboBoxorEdit_99C4/clip_image002_thumb.jpg"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;So how do you fix this? The magic lies in the &lt;A href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx" mce_href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx"&gt;SizeString&lt;/A&gt;&lt;B&gt; &lt;/B&gt;property. However, the use of this property is not so obvious. Instead of setting this property to a number such as &lt;B&gt;20 &lt;/B&gt;for 20 characters of space, you must type an actual character for each character’s worth of space you want to allocate for the text width. &lt;/P&gt;
&lt;P&gt;For example, to make enough space for the string “I love Visual Studio Tools for Office!”, set the &lt;A href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx" mce_href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx"&gt;SizeString&lt;/A&gt; property of the drop down to “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” or “jlkjlkjlkjlkjdlslaledfoplklksjjklsfdf” etc. &lt;/P&gt;
&lt;P&gt;You can also decrease the size of the text area to show fewer characters than appear by default. For example, just set &lt;A href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx" mce_href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbondropdown.sizestring.aspx"&gt;SizeString&lt;/A&gt; to “xx” if you want only two characters to appear. &lt;/P&gt;
&lt;P&gt;Norm E.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9242650" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category></item><item><title>I Just Want to Format a Cell in My Excel Worksheet (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2008/06/03/i-just-want-to-format-a-cell-in-my-excel-worksheet-norm-estabrook.aspx</link><pubDate>Tue, 03 Jun 2008 20:41:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8571844</guid><dc:creator>VSTO Team</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8571844.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8571844</wfw:commentRss><description>&lt;p&gt;So you just want to write some code to format a cell in a worksheet. However, there isn't a help topic in sight that shows you how to do it. There may be a topic out there, but you don't have time to sift through the web searching for it. You're not alone. The forums are filled with questions about how to accomplish what might seem like a simple task - like formatting a cell.&amp;#160; But the search for the right class, method or property to do it is not so simple.&lt;/p&gt;  &lt;p&gt;A great way to get unstuck on some of these small but distracting issues is to use the Excel macro recorder. Start the recorder, pick a cell, format the cell, stop the recorder and then look at the code that Excel generates.&amp;#160; The trickiest part is translating the VBA code to C# or VB so that you can use the code in your VSTO project. However, doing this can be a lot easier than searching the web and MSDN for a topic that shows you which specific class or property in the massive Excel object model you need to perform your task.&lt;/p&gt;  &lt;p&gt;Let's take a look at an example scenario.&amp;#160; All I want to do is format a cell as a percentage with 2 decimal places on the right side. The Macro recorder will show me which method or property I need to use.&lt;/p&gt;  &lt;p&gt;To use the Macro recorder in Excel 2007, you have to enable the developer tab in the Ribbon.&amp;#160; Click the round Office button and then click &amp;quot;Excel Options&amp;quot;. Then select the &amp;quot;Show Developer tab in the Ribbon&amp;quot; as follows.&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="653" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="320"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="333" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb.png" width="261" border="0" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td valign="top" width="331"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_12.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="253" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_5.png" width="380" border="0" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Start the macro recorder as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_16.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="276" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_7.png" width="383" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Select a cell and then set your formatting options as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_18.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="309" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_8.png" width="349" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Stop the macro recorder.&amp;#160; Open the macro in the VBA editor as follows:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="653" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="320"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_24.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="308" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_11.png" width="299" border="0" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td valign="top" width="331"&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_22.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="275" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/e3f742207fc3_D51A/image_thumb_10.png" width="290" border="0" /&gt;&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Grab the generated VBA. For example the VBA generated by the macro that I recorded looks like this:&lt;/p&gt;  &lt;p&gt;Range(&amp;quot;B2&amp;quot;).Select    &lt;br /&gt;Selection.NumberFormat = &amp;quot;0.00%&amp;quot;&lt;/p&gt;  &lt;p&gt;Ok this is good. Basically the code is selecting cell B2 and then setting the &amp;quot;NumberFormat&amp;quot; property of the selected range to a percentage with 2 right-side decimal positions.&amp;#160; I just need to open my VSTO project and add code that gets the range for cell B2, and then sets NumberFormat property of that range to &amp;quot;0.00%&amp;quot; as follows:&lt;/p&gt;  &lt;p&gt;[C#]&lt;/p&gt;  &lt;pre class="code"&gt;Excel.&lt;span style="color: #2b91af"&gt;Range &lt;/span&gt;range1 = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Range[&lt;span style="color: #a31515"&gt;&amp;quot;B2&amp;quot;&lt;/span&gt;, missing];
range1.NumberFormat = &lt;span style="color: #a31515"&gt;&amp;quot;0.00%&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;[VB]&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;range1 &lt;span style="color: blue"&gt;As &lt;/span&gt;Excel.Range = &lt;span style="color: blue"&gt;Me&lt;/span&gt;.Range(&lt;span style="color: #a31515"&gt;&amp;quot;B2&amp;quot;&lt;/span&gt;)
range1.NumberFormat = &lt;span style="color: #a31515"&gt;&amp;quot;0.00%&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;This assumes that you add this code to a sheet class in a document-level customization project. If you are using an application-level add-in project, you might use something like the following which formats the cell &amp;quot;B2&amp;quot; in the default sheet of the workbook.&lt;/p&gt;

&lt;p&gt;[C#]&lt;/p&gt;

&lt;pre class="code"&gt;Excel.&lt;span style="color: #2b91af"&gt;Range &lt;/span&gt;range1 = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application.get_Range(&lt;span style="color: #a31515"&gt;&amp;quot;B2&amp;quot;&lt;/span&gt;, missing);
range1.NumberFormat = &lt;span style="color: #a31515"&gt;&amp;quot;0.00%&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;[VB]&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;Dim &lt;/span&gt;range1 &lt;span style="color: blue"&gt;As &lt;/span&gt;Excel.Range = Application.Range(&lt;span style="color: #a31515"&gt;&amp;quot;B2&amp;quot;&lt;/span&gt;)
range1.NumberFormat = &lt;span style="color: #a31515"&gt;&amp;quot;0.00%&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;I might have found a topic that shows me how to format a cell as a percentage, but sometimes using the macro recorder can be a lot faster.&amp;#160; Especially if the task you want to perform is something that can be done by using common Excel features. &lt;/p&gt;

&lt;p&gt;You can still search for answers in the docs. The topic &lt;a href="http://msdn.microsoft.com/en-us/library/wss56bz7.aspx"&gt;Excel Object Model Overview&lt;/a&gt; is a great place to start. There is a section in that topic named &amp;quot;Using the Excel Object Model Documentation&amp;quot; that lists several resources.&lt;/p&gt;

&lt;p&gt;Norm E.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8571844" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2007/default.aspx">Office 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+2003/default.aspx">Office 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2003/default.aspx">Excel 2003</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category></item><item><title>Making a Custom Group Appear in the Message Tab of a Mail Item (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2008/04/09/making-a-custom-group-appear-in-the-message-tab-a-mail-item-norm-estabrook.aspx</link><pubDate>Wed, 09 Apr 2008 19:49:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8372731</guid><dc:creator>VSTO Team</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8372731.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8372731</wfw:commentRss><description>&lt;p&gt;You can add a custom group to the &lt;strong&gt;Message&lt;/strong&gt; tab of an Outlook mail item.&amp;#160; For example, here is a custom group named &amp;quot;MyCoolGroup&amp;quot; that I added to the message tab of a new message:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_9.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_9.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="227" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_3.png" width="674" border="0" mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_3.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Outlook lets you open a message in the following two modes: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Compose (you are drafting a new message). &lt;/li&gt;    &lt;li&gt;Read (you are reading a message).&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Making a custom group appear for only one of these modes is pretty easy.&amp;#160; Making it appear for both modes is a tad more challenging. That is because the control ID of the &lt;strong&gt;Message&lt;/strong&gt; tab in read mode is different than the control ID of the &lt;strong&gt;Message&lt;/strong&gt; tab in compose mode. When you design your custom group in the VSTO Ribbon designer, you can only specify &lt;strong&gt;one&lt;/strong&gt; control ID. This means that when you run the project, the custom group will only appear in the &lt;strong&gt;Message&lt;/strong&gt; tab of a compose window or the &lt;strong&gt;Message&lt;/strong&gt; tab of a read window depending on which control ID you specify at design-time. &lt;/p&gt;  &lt;p&gt;If you want the group to appear in both versions of the &lt;strong&gt;Message&lt;/strong&gt; tab (read and compose), you have to do a bit more work. Here is how you make the group appear for both modes:&lt;/p&gt;  &lt;p&gt;First, add a &lt;strong&gt;Ribbon (Visual Designer)&lt;/strong&gt; to an Outlook 2007 add-in project.&lt;/p&gt;  &lt;p&gt;Then, set the &lt;strong&gt;RibbonType&lt;/strong&gt; property of the Ribbon to &lt;strong&gt;Microsoft.Outlook.Mail.Compose&lt;/strong&gt; and &lt;strong&gt;Microsoft.Outlook.Mail.Read&lt;/strong&gt; as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="466" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_1.png" width="506" border="0" mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_1.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;On the Ribbon designer, add a group to a tab and customize the group as desired.&amp;#160; &lt;/p&gt;  &lt;p&gt;On the Ribbon designer, select the tab, open the &lt;strong&gt;Properties&lt;/strong&gt; window, and then set the &lt;strong&gt;OfficeId&lt;/strong&gt; of the tab to &lt;strong&gt;TabReadMessage&lt;/strong&gt;.&amp;#160; &lt;strong&gt;TabReadMessage&lt;/strong&gt; is the control ID of the default tab that appears on the Ribbon of a mail message that is open in read mode.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_7.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_7.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="336" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_2.png" width="405" border="0" mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DisplayingaCustomGroupinBoththeOutlookMa_D2A0/image_thumb_2.png" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Ok. Now when you run the project, your custom group will appear only if you open a mail item in read mode. Now you need to add a little code to display the custom group in the &lt;strong&gt;Message&lt;/strong&gt; tab of a new mail item. That is, a mail item that you open in compose mode.&lt;/p&gt;  &lt;p&gt;To do this, create an event handler for the &lt;a href="http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspectorsevents_newinspectoreventhandler.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.outlook.inspectorsevents_newinspectoreventhandler.aspx"&gt;NewInspector&lt;/a&gt; event. This event is raised every time a new Outlook inspector is open. In the event handler, check the EntryID property of the mail item. If this property is null, then the item is a new message.&amp;#160; If that is the case, set the &lt;strong&gt;OfficeId&lt;/strong&gt; property of the tab to &lt;strong&gt;TabNewMailMessage&lt;/strong&gt;.&amp;#160;&amp;#160; &lt;strong&gt;TabNewMailMessage&lt;/strong&gt; is the control ID of the &lt;strong&gt;Message&lt;/strong&gt; tab of a mail message in compose mode.&amp;#160; &lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;Outlook.&lt;span style="color: #2b91af"&gt;Inspectors &lt;/span&gt;inspectors;
&lt;span style="color: blue"&gt;private void &lt;/span&gt;ThisAddIn_Startup(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, System.&lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
{
    inspectors = &lt;span style="color: blue"&gt;this&lt;/span&gt;.Application.Inspectors;
    inspectors.NewInspector += 
        &lt;span style="color: blue"&gt;new &lt;/span&gt;Microsoft.Office.Interop.Outlook.&lt;span style="color: #2b91af"&gt;InspectorsEvents_NewInspectorEventHandler
            &lt;/span&gt;(Inspectors_NewInspector);
}

&lt;span style="color: blue"&gt;void &lt;/span&gt;Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.&lt;span style="color: #2b91af"&gt;Inspector &lt;/span&gt;Inspector)
{
    Outlook.&lt;span style="color: #2b91af"&gt;MailItem &lt;/span&gt;tmpMailItem = (Outlook.&lt;span style="color: #2b91af"&gt;MailItem&lt;/span&gt;)Inspector.CurrentItem;
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(tmpMailItem != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(tmpMailItem.EntryID == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
            &lt;span style="color: #2b91af"&gt;Globals&lt;/span&gt;.Ribbons.Ribbon1.tab1.ControlId.OfficeId = &lt;span style="color: #a31515"&gt;&amp;quot;TabNewMailMessage&amp;quot;&lt;/span&gt;;
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;You can read more about adding custom groups to built-in tabs in the following MSDN articles:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb608593.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb608593.aspx"&gt;How to: Customize a Built-in tab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb608616.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb608616.aspx"&gt;How to: Get Started Customizing the Ribbon&lt;/a&gt;&lt;/p&gt;
&lt;a href="http://msdn2.microsoft.com/en-us/library/bb386089.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb386089.aspx"&gt;Ribbon Designer&lt;/a&gt; 

&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/bb398246.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb398246.aspx"&gt;Customizing a Ribbon for Outlook&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8372731" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category></item><item><title>Share a Ribbon Customization between Office Applications (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2008/03/10/share-a-ribbon-customization-between-office-applications.aspx</link><pubDate>Mon, 10 Mar 2008 23:01:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8137160</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8137160.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8137160</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;We have received feedback from several folks that they would like design one Ribbon by using the Ribbon visual designer, and then re-use that same Ribbon in more than one Office application. This approach makes sense. If my custom tab looks the same for each application, I really don’t want to create the same Ribbon in&amp;nbsp;four separate Office projects.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;So I poked around to see if this was possible. I caught up with one of developers who created the VSTO Ribbon designer and he showed me exactly how to do it. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;First, add a Ribbon to a VSTO project. Then, copy the Ribbon code files to a class library project. Finally, add a reference to the class library assembly from within any VSTO project and voila. Well, it’s a tad more challenging.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Here are all the detailed steps.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Create the Ribbon&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Create a 2007 Excel, Outlook, PowerPoint, or Word project in Visual Studio. For the purpose of these steps, create a C# project and name the project &lt;I style="mso-bidi-font-style: normal"&gt;RibbonStarterProject&lt;/I&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Add a &lt;B style="mso-bidi-font-weight: normal"&gt;Ribbon (Visual Designer)&lt;/B&gt; item to the project. For the purpose of these steps, accept the default name “Ribbon1”.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l2 level1 lfo1; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Save and close the project.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Create a Class Library Project&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Create a new class library project in Visual Studio. For the purpose of these steps, name the project &lt;I style="mso-bidi-font-style: normal"&gt;SharedRibbonLibrary&lt;/I&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 1.5pt 0in 1.5pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Add a project reference to the &lt;B style="mso-bidi-font-weight: normal"&gt;Microsoft.Office.Tools.Common.v9.0&lt;/B&gt; assembly.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 1.5pt 0in 1.5pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;On the &lt;SPAN class=ui&gt;&lt;STRONG&gt;Project&lt;/STRONG&gt;&lt;/SPAN&gt; Menu in Visual Studio, click &lt;SPAN class=ui&gt;&lt;STRONG&gt;Add Existing Item&lt;/STRONG&gt;&lt;/SPAN&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=NumberedList1 style="MARGIN: 3pt 0in 3pt 0.25in; mso-list: l1 level1 lfo3"&gt;&lt;SPAN style="mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Verdana&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-family: Arial"&gt;&lt;FONT face=Verdana&gt;In the &lt;SPAN class=ui&gt;&lt;STRONG&gt;Add Existing Item&lt;/STRONG&gt;&lt;/SPAN&gt; dialog box, browse to the “RibbonStarterProject” project directory, select the Ribbon.cs file, and click &lt;B style="mso-bidi-font-weight: normal"&gt;Add&lt;/B&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Ribbon1.cs is copied to the project directory and appears beneath the project node in &lt;SPAN class=ui&gt;&lt;STRONG&gt;Solution Explorer&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;5.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Double-click &lt;B style="mso-bidi-font-weight: normal"&gt;Ribbon1.cs&lt;/B&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;The Ribbon designer appears.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 1.5pt 0in 1.5pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;6.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;From the &lt;SPAN class=ui&gt;&lt;STRONG&gt;Office Ribbon Controls &lt;/STRONG&gt;&lt;/SPAN&gt;tab of the &lt;SPAN class=ui&gt;&lt;STRONG&gt;Toolbox&lt;/STRONG&gt;&lt;/SPAN&gt;, drag a button onto &lt;SPAN class=ui&gt;&lt;STRONG&gt;group1&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 1.5pt 0in 1.5pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;7.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Click &lt;SPAN class=ui&gt;&lt;STRONG&gt;button1&lt;/STRONG&gt;&lt;/SPAN&gt; to select it.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 1.5pt 0in 1.5pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;8.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;In the &lt;SPAN class=ui&gt;&lt;STRONG&gt;Properties &lt;/STRONG&gt;&lt;/SPAN&gt;window, set &lt;SPAN class=ui&gt;&lt;STRONG&gt;Modifiers&lt;/STRONG&gt;&lt;/SPAN&gt; to &lt;SPAN class=input&gt;&lt;STRONG&gt;Public&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 1.5pt 0in 1.5pt 0.25in"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Note:&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;By default, controls that you add to the Ribbon are Internal. That makes them only accessible to code inside the same assembly. However, when you access these controls, you will be accessing them through an assembly reference. Therefore, to reach them from code, you must make them public. More on this soon.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;9.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Right-click the Ribbon designer, and then click &lt;B style="mso-bidi-font-weight: normal"&gt;Properties&lt;/B&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;10.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;In the &lt;B style="mso-bidi-font-weight: normal"&gt;Properties&lt;/B&gt; window, click the &lt;SPAN class=ui&gt;&lt;STRONG&gt;RibbonType&lt;/STRONG&gt;&lt;/SPAN&gt; property, and then select the Ribbon ID’s of the applications or Outlook Inspector windows in which you want the Ribbon to appear. For more information about this property, see the MSDN reference topic for the &lt;A href="http://msdn2.microsoft.com/en-us/library/microsoft.office.tools.ribbon.officeribbon.ribbontype.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/microsoft.office.tools.ribbon.officeribbon.ribbontype.aspx"&gt;RibbonType&lt;/A&gt; property.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;11.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;In &lt;B style="mso-bidi-font-weight: normal"&gt;Solution Explorer&lt;/B&gt;, right-click &lt;B style="mso-bidi-font-weight: normal"&gt;Ribbon1.cs&lt;/B&gt;, and then click &lt;B style="mso-bidi-font-weight: normal"&gt;View Code&lt;/B&gt;.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;12.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Change the namespace of the class to “SharedRibbonLibrary”.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;13.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Repeat this step for the Ribbon1.designer.cs file.&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo3; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;14.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Compile and save the SharedRibbonLibrary project. You can now use the resulting assembly in any VSTO project that supports the Ribbon.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Consume the Ribbon Customization&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Create 2007 Excel, Outlook, PowerPoint, or Word project.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Add a reference to the SharedRibbonLibrary assembly.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Add the following code to the &lt;SPAN class=code&gt;&lt;SPAN style="FONT-FAMILY: Verdana; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.0pt; mso-ansi-font-size: 10.0pt"&gt;&lt;FONT color=#000066&gt;ThisAddin&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;, &lt;/SPAN&gt;&lt;SPAN class=code&gt;&lt;SPAN style="FONT-FAMILY: Verdana; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.0pt; mso-ansi-font-size: 10.0pt"&gt;&lt;FONT color=#000066&gt;ThisWorkbook&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt;, or &lt;/SPAN&gt;&lt;SPAN class=code&gt;&lt;SPAN style="FONT-FAMILY: Verdana; mso-bidi-font-family: Arial; mso-bidi-font-size: 10.0pt; mso-ansi-font-size: 10.0pt"&gt;&lt;FONT color=#000066&gt;ThisDocument&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: black"&gt; class of your project. This code overrides the &lt;B&gt;CreateRibbonExtensibilityObject&lt;/B&gt; method and returns the Ribbon to the Office application.&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;protected&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;override&lt;/SPAN&gt; Microsoft.Office.Core.&lt;SPAN style="COLOR: #2b91af"&gt;IRibbonExtensibility&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;CreateRibbonExtensibilityObject()&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Microsoft.Office.Tools.Ribbon.&lt;SPAN style="COLOR: #2b91af"&gt;RibbonManager&lt;/SPAN&gt;(&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; Microsoft.Office.Tools.Ribbon.&lt;SPAN style="COLOR: #2b91af"&gt;OfficeRibbon&lt;/SPAN&gt;[] { &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;SharedRibbonLibrary.&lt;SPAN style="COLOR: #2b91af"&gt;Ribbon1&lt;/SPAN&gt;() });&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;4.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Add a new class to the project. Accept the default name “Class1.cs”.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l3 level1 lfo4; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;5.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Replace the code in the Class1 file with the following:&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;partial&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt; &lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ThisRibbonCollection&lt;/SPAN&gt; : Microsoft.Office.Tools.Ribbon.&lt;SPAN style="COLOR: #2b91af"&gt;RibbonReadOnlyCollection&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;internal&lt;/SPAN&gt; SharedRibbonLibrary.&lt;SPAN style="COLOR: #2b91af"&gt;Ribbon1&lt;/SPAN&gt; Ribbon1&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt; { &lt;SPAN style="COLOR: blue"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.GetRibbon&amp;lt;SharedRibbonLibrary.&lt;SPAN style="COLOR: #2b91af"&gt;Ribbon1&lt;/SPAN&gt;&amp;gt;(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;}&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Ok – You are done! You can now access the Ribbon and the button that you added to the Ribbon in your code.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Lets try by handling an event in the consuming project.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Handle the Button Click Event&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo5; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;1.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Add the following code to the startup event handler of project. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;Globals&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;.Ribbons.Ribbon1.button1.Click += &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;EventHandler&lt;/SPAN&gt;&amp;lt;Microsoft.Office.Tools.Ribbon.&lt;SPAN style="COLOR: #2b91af"&gt;RibbonControlEventArgs&lt;/SPAN&gt;&amp;gt;(button1_Click);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo5; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;2.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Add the following event handler to your project:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; button1_Click(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;Microsoft.Office.Tools.Ribbon.&lt;SPAN style="COLOR: #2b91af"&gt;RibbonControlEventArgs&lt;/SPAN&gt; e)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;System.Windows.Forms.&lt;SPAN style="COLOR: #2b91af"&gt;MessageBox&lt;/SPAN&gt;.Show(&lt;SPAN style="COLOR: #a31515"&gt;"I can handle events!"&lt;/SPAN&gt;);&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; mso-layout-grid-align: none"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: 'Courier New'; mso-no-proof: yes"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo5; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;3.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;Run the project. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo5; tab-stops: list .25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-fareast-font-family: Verdana; mso-bidi-font-family: Verdana"&gt;&lt;SPAN style="mso-list: Ignore"&gt;4.&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;When the Office application opens, click the &lt;B style="mso-bidi-font-weight: normal"&gt;Add-Ins&lt;/B&gt; tab, and then click your button. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;A message that says “I can handle events!” appears.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;- Norm Estabrook&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 0.25in"&gt;&lt;EM&gt;&lt;SPAN lang=EN style="FONT-FAMILY: Corbel; mso-ansi-language: EN"&gt;&lt;FONT size=3&gt;Programming Writer for BizApps User Education&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/EM&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana; mso-bidi-font-family: Arial"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8137160" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Outlook+2007/default.aspx">Outlook 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Ribbon/default.aspx">Ribbon</category></item><item><title>Automatically Deploy Any File to SharePoint When you Debug a SharePoint Solution (Norm Estabrook)</title><link>http://blogs.msdn.com/vsto/archive/2008/01/31/automatically-deploy-any-file-to-sharepoint-when-you-debug-a-sharepoint-solution.aspx</link><pubDate>Thu, 31 Jan 2008 22:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7356624</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/7356624.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=7356624</wfw:commentRss><description>&lt;FONT face="Times New Roman" size=3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;When you debug a SharePoint workflow project, the workflow deployment process copies the feature.xml and workflow.xml to a feature directory on SharePoint.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;You can configure your solution to deploy other files as well. For example, you might want to deploy InfoPath (*.xsn) files that provide a UI for the workflow, or a file that contains localized resource strings.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;To do this, open the feature.xml file of your solution, and add an element named &lt;A href="http://msdn2.microsoft.com/en-us/library/ms416158.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/ms416158.aspx"&gt;ElementFile&lt;/A&gt; for each file that you want to deploy along with your project. Set the &lt;B style="mso-bidi-font-weight: normal"&gt;Location&lt;/B&gt; attribute of the element to the name of the file. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=AlertTextinList1 style="MARGIN: 3pt 0in 3pt 0.5in"&gt;&lt;FONT size=2&gt;&lt;SPAN class=LabelEmbedded&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;If the file is located outside of the root directory of the SharePoint solution, ensure that the name includes a relative path. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=TextinList1 style="MARGIN: 3pt 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;FONT size=2&gt;The following example specifies an InfoPath form named &lt;SPAN class=CodeEmbedded&gt;&lt;SPAN style="FONT-FAMILY: Arial"&gt;&lt;FONT color=#000080&gt;InitiationForm&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;. This form is located in the root directory of the SharePoint solution so the name does not require a relative file path.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&amp;lt;Feature&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Id="c8ff5406-135a-4fba-8507-ff4d311434a7"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Title="SharePointFormsWorkflow feature"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Description="My SharePoint Workflow Feature"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Version="12.0.0.0"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Scope="Site"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;ReceiverAssembly="Microsoft.Office.Workflow.Feature,&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;Version=12.0.0.0, Culture=neutral,&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;PublicKeyToken=71e9bce111e9429c" ReceiverClass="Microsoft.Office.Workflow.Feature.WorkflowFeatureReceiver"&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;xmlns="http://schemas.microsoft.com/sharepoint/"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;ElementManifests&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;ElementManifest Location="workflow.xml" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT color=#000080&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=CodeFeaturedElement&gt;&lt;SPAN style="FONT-SIZE: 11pt; COLOR: red"&gt;&lt;STRONG&gt;&amp;lt;ElementFile Location="InitiationForm.xsn" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/ElementManifests&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;Properties&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;Property Key="GloballyAvailable" Value="true" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;Property Key="RegisterForms" Value="*.xsn" /&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=CodeinList1 style="MARGIN: 0in 0in 3pt 0.25in"&gt;&lt;SPAN style="FONT-SIZE: 11pt; mso-bidi-font-family: 'Courier New'"&gt;&lt;FONT color=#000080&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&amp;lt;/Properties&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 11pt; COLOR: navy; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/Feature&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"&gt;The VSTO documentation has been updated with this information and will appear on MSDN soon.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=7356624" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/SharePoint+workflow/default.aspx">SharePoint workflow</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Norm+Estabrook/default.aspx">Norm Estabrook</category></item></channel></rss>