<?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 : Excel 2007</title><link>http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx</link><description>Tags: Excel 2007</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>BUG: “Old format or invalid type library” error when automating Excel (Christin Boyd)</title><link>http://blogs.msdn.com/vsto/archive/2009/07/06/bug-old-format-or-invalid-type-library-error-when-automating-excel-christin-boyd.aspx</link><pubDate>Tue, 07 Jul 2009 01:54:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9820860</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9820860.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9820860</wfw:commentRss><description>&lt;p&gt;A customer recently reported this bug when running their Shared Addin for Excel on French Windows.&amp;#160; &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Error: 0x80028018 (-2147647512)      &lt;br /&gt;Description: Old Format or Invalid Type Library&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;His solution worked great on English Windows, but gave errors in any other language.&amp;#160; This is a known problem in Excel and there are a few workarounds that work depending on the way you’re writing your Excel Addin.&amp;#160;&amp;#160; Let me take you through the problem, variations on the problem, and different solutions depending on which Visual Studio project template you choose to start your Addin.&lt;/p&gt;  &lt;p&gt;The bug was originally documented in a &lt;a href="http://support.microsoft.com/kb/320369" target="_blank"&gt;KB 320369 article&lt;/a&gt;, which gives detailed repro steps, explanation, and two workarounds with sample code.&amp;#160; So why am I writing a blog post if the KB article covers everything?&amp;#160;&amp;#160; Three reasons.&amp;#160; &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Because we’re fixing the problem in CLR 4 and I want to encourage you to use one of the recommended workarounds in your current solutions so that you’re ready when your users upgrade to .NET Framework 4.&amp;#160; &lt;/li&gt;    &lt;li&gt;Also, there are parts of the KB article that are a bit confusing, so I’ll try to add some color commentary to help explain what’s causing the problem.&amp;#160; &lt;/li&gt;    &lt;li&gt;And third, these problems do not occur if you use VSTO 2005 SE, VSTO 3.0 (which ships with Visual Studio 2008), or Visual Studio 2010.&amp;#160; I’ll explain why and how later. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The KB article describes the problem:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Error: 0x80028018 (-2147647512)      &lt;br /&gt;Description: Old Format or Invalid Type Library&lt;/p&gt;    &lt;p&gt;You receive this error calling an Excel method when the following conditions are true: &lt;/p&gt;    &lt;ul&gt;     &lt;li&gt;The method requires an LCID (locale identifier). &lt;/li&gt;      &lt;li&gt;You run an English version of Excel. However, the regional settings for the computer are configured for a non-English language. &lt;/li&gt;   &lt;/ul&gt;    &lt;p&gt;If the client computer runs the English version of Excel and the locale for the current user is configured for a language other than English, Excel will try to locate the language pack for the configured language. If the language pack is not found, the error is reported.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The quote from the KB article is accurate, but can be confusing.&amp;#160; It is very difficult to determine if the Excel method you want to call requires LCID or not.&amp;#160; The Primary Interop Assembly (PIA) does not indicate whether or not the LCID is needed, however VBA does not hide the need for LCID.&amp;#160; Part of the reason why Excel hasn’t changed its methods is to maintain back compatibility with all the VBA code in the universe.&amp;#160; &lt;/p&gt;  &lt;h3&gt;Fixed in VSTO&lt;/h3&gt;  &lt;p&gt;VSTO implemented a fix in VSTO 2005 Second Edition (SE).&amp;#160; You can read more about this fix in &lt;a href="http://blogs.msdn.com/eric_carter/archive/2005/06/15/429515.aspx" target="_blank"&gt;Eric Carter’s blog post&lt;/a&gt;.&amp;#160; The fix is also in all subsequent versions of Visual Studio 2008 and will be in Visual Studio 2010.&amp;#160; You know you are using “VSTO” when you create a new Project in Visual Studio and select an Excel &amp;lt;version number&amp;gt; Workbook, Excel &amp;lt;version number&amp;gt; Template or Excel &amp;lt;version number&amp;gt; Addin.&amp;#160; The fix was not implemented in the Shared Addin template in any version of Visual Studio.&amp;#160; If you create a WinForms, WPF, Web or console application that calls Excel, then you will see this bug on non-English Windows.&lt;/p&gt;  &lt;h3&gt;Workarounds &lt;/h3&gt;  &lt;p&gt;If you are using the Shared Addin template, a WinForm, WPF, Web or Console application with any version of Visual Studio, then you should use the &lt;a href="http://support.microsoft.com/kb/320369" target="_blank"&gt;KB 320369 article&lt;/a&gt; to solve the problem.&lt;/p&gt;  &lt;p&gt;The workaround is to write explicit calls to set the thread’s culture before calling into Excel.&amp;#160; You can then reset the culture back to what it was before after you are finished calling Excel.&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Install the Multilingual User Interface Pack for your version of Office. &lt;/li&gt;    &lt;li&gt;Execute the Excel method or property by using &lt;b&gt;InvokeMember&lt;/b&gt; so that you can specify the &lt;b&gt;CultureInfo&lt;/b&gt; for the call. For example, the following code illustrates how you can invoke the &lt;b&gt;Workbooks&lt;/b&gt; object &lt;b&gt;Add&lt;/b&gt; method with &amp;quot;en-US&amp;quot; as the &lt;b&gt;CultureInfo&lt;/b&gt;:       &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;       &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oApp &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; Excel.Application()&lt;br /&gt;oApp.Visible = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;oApp.UserControl = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oBooks &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Object&lt;/span&gt; = oApp.Workbooks&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; ci &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Globalization.CultureInfo = &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; System.Globalization.CultureInfo(&lt;span style="color: #006080"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;)&lt;br /&gt;oBooks.&lt;span style="color: #0000ff"&gt;GetType&lt;/span&gt;().InvokeMember(&lt;span style="color: #006080"&gt;&amp;quot;Add&amp;quot;&lt;/span&gt;, Reflection.BindingFlags.InvokeMethod, &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt;, oBooks, &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt;, ci)&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;

      &lt;br /&gt;&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Or, instead of the above bullet and code sample, set the &lt;b&gt;CultureInfo&lt;/b&gt; prior to calling the Excel method, and then you can reset it after your Excel call: &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;
    &lt;pre id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oApp &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; Excel.Application()&lt;br /&gt;oApp.Visible = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;oApp.UserControl = &lt;span style="color: #0000ff"&gt;True&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; oldCI &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; System.Globalization.CultureInfo = _&lt;br /&gt;    System.Threading.Thread.CurrentThread.CurrentCulture&lt;br /&gt;System.Threading.Thread.CurrentThread.CurrentCulture = _&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;New&lt;/span&gt; System.Globalization.CultureInfo(&lt;span style="color: #006080"&gt;&amp;quot;en-US&amp;quot;&lt;/span&gt;)&lt;br /&gt;oApp.Workbooks.Add()&lt;br /&gt;System.Threading.Thread.CurrentThread.CurrentCulture = oldCI&lt;/pre&gt;

    &lt;br /&gt;&lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;The .NET Framework 4 will solve this whole culture problem.&amp;#160; Excel is not going to change its culture sensitivity because of the need to support backwards compatibility.&amp;#160;&amp;#160; Starting with CLR 4.0, when managed code calls into a COM component and an LCID is required, then the CLR will pass LCID = 1033.&amp;#160; Note that this is how VBA passes LCIDs.&amp;#160;&amp;#160; This means that Visual Studio 2010 project templates for Excel Addins can stop wrapping all Excel projects with LCID proxy.&amp;#160;&amp;#160; In the future, when you use VS 2010 and .NET 4 to write your Excel automation programs from a Shared Addin, console, Winforms, WPF, or Web application, you won’t need to wrap your calls either.&amp;#160; &lt;/p&gt;

&lt;p&gt;-Christin Boyd, Program Manager &amp;amp; &lt;a href="http://blogs.msdn.com/mshneer/" target="_blank"&gt;Misha Shneerson&lt;/a&gt;, Senior Developer&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9820860" 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/Christin+Boyd/default.aspx">Christin Boyd</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><category domain="http://blogs.msdn.com/vsto/archive/tags/primary+interop+assemblies/default.aspx">primary interop assemblies</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VBA/default.aspx">VBA</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>VSTO Bug Tracker (Eric Carter, Beth Massi)</title><link>http://blogs.msdn.com/vsto/archive/2009/05/18/vsto-bug-tracker-eric-carter-beth-massi.aspx</link><pubDate>Mon, 18 May 2009 23:16:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9625928</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9625928.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9625928</wfw:commentRss><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/eric_carter/" target="_blank"&gt;Eric Carter&lt;/a&gt; released &lt;a href="http://code.msdn.microsoft.com/VSTOBugTracker" target="_blank"&gt;a sample and series of articles&lt;/a&gt; based on his TechEd demo last week that shows you how to bring bug data from TFS into Excel and Word using VSTO so it can be further analyzed. &lt;/p&gt;  &lt;p&gt;If you you went to TechEd but missed the session you can watch it here if you’ve registered:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.msteched.com/online/view.aspx?tid=2f9f0f7f-f546-4465-a618-744bff15d0b0"&gt;Advanced Microsoft Office Word and Excel 2007 Development in Microsoft Visual Studio 2008 with Visual Studio Tools for Office&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/VSTOBugTracker" target="_blank"&gt;&lt;strong&gt;Everyone can download the sample here.&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And don’t forget to check the &lt;a href="http://msdn.com/vsto" target="_blank"&gt;VSTO Dev Center&lt;/a&gt; often for more news, &lt;a href="http://msdn.microsoft.com/en-us/vsto/dd164305.aspx" target="_blank"&gt;articles&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/vsto/dd164303.aspx" target="_blank"&gt;videos&lt;/a&gt;, and samples.&lt;/p&gt;  &lt;p&gt;Enjoy,   &lt;br /&gt;-&lt;a href="http://blogs.msdn.com/bethmassi" target="_blank"&gt;Beth Massi&lt;/a&gt;, Visual Studio Community&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9625928" 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/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/sample/default.aspx">sample</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category></item><item><title>TechEd Sessions on Office Development</title><link>http://blogs.msdn.com/vsto/archive/2009/05/07/teched-sessions-on-office-development.aspx</link><pubDate>Fri, 08 May 2009 00:16:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9594976</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9594976.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9594976</wfw:commentRss><description>&lt;p&gt;If you’re going to TechEd in Los Angeles next week, then don’t miss these four sessions:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;b&gt;DTL03-INT Meet the Microsoft Visual Studio Team&lt;/b&gt;     &lt;br /&gt;Christin Boyd, &lt;a href="http://blogs.msdn.com/eric_carter/default.aspx" target="_blank"&gt;Eric Carter&lt;/a&gt;, Paul Yuknewicz, Jay Schmelzer, &lt;a href="http://diditwith.net/" target="_blank"&gt;Dustin Campbell&lt;/a&gt;, Jonathan Aneja, &lt;a href="http://blogs.msdn.com/lukeh/" target="_blank"&gt;Luke Hoban&lt;/a&gt;, Igor Zinkovsky, Faisal Nasir, &lt;a href="http://devhawk.net/" target="_blank"&gt;Harry Pierson&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/vbteam/" target="_blank"&gt;Lisa Feigenbaum&lt;/a&gt;     &lt;br /&gt;Mon 5/11&amp;#160; 2:45 PM-4:00 PM | Blue Theater 1     &lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;OFC325&amp;#160; Building Custom Applications in Microsoft Office Outlook 2007&lt;/strong&gt;     &lt;br /&gt;&lt;a href="http://officedeveloper.net/" target="_blank"&gt;Ty Anderson&lt;/a&gt;, Damon Armstrong     &lt;br /&gt;Tue 5/12&amp;#160; 2:45 PM-4:00 PM | Room 408A&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;DTL324 - Microsoft Visual Studio 2010 Overview for the Business Application Developer &lt;/strong&gt;    &lt;br /&gt;Jay Schmelzer     &lt;br /&gt;Tue 5/12 4:30 PM-5:45 PM | Room 515B&lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;OFC324&lt;/b&gt;     &lt;br /&gt;&lt;b&gt;Advanced Microsoft Office Word and Excel 2007 Development in Microsoft Visual Studio 2008 with Visual Studio Tools for Office&lt;/b&gt;     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/eric_carter/default.aspx" target="_blank"&gt;Eric Carter&lt;/a&gt;     &lt;br /&gt;Thursday 5/14 1:00PM-2:15PM | Room 515A&lt;/p&gt;  &lt;p&gt;Of course, there are a dozen other sessions that appeal to Office developers and SharePoint developers.&amp;#160; These are the four that I highly recommend.&amp;#160; Originally I was going to list the 3 not-to-be-missed sessions, but then I couldn’t drop any of these from my list, so we have 4 Must See Sessions!&amp;#160; &lt;/p&gt;  &lt;p&gt;If you’re not going to TechEd, then please click the links on these speakers’ names to read their blogs where the will eventually post some of their demo code.&amp;#160; Expect the posts to happen the Monday after their sessions.&amp;#160; In the case of Eric Carter, he would probably love it if you’d buy his book, &lt;a href="http://www.amazon.com/Visual-Studio-Tools-Office-2007/dp/0321533216" target="_blank"&gt;Visual Studio Tools for Office 2007: VSTO for Excel, Word and Outlook&lt;/a&gt;&lt;u&gt;&lt;/u&gt;.&amp;#160; Or you could just download a zip file with all of the of code from the book &lt;a href="http://blogs.msdn.com/eric_carter/archive/2009/03/14/visual-studio-tools-for-office-2007-code-listings.aspx" target="_blank"&gt;here&lt;/a&gt;.&amp;#160; That should keep you busy for a while.&amp;#160; The explanations in the book really do add to the overall value.&amp;#160; I should credit the co-author, Eric Lippert.&amp;#160; Both men are brilliant and funny, and very modest.&amp;#160; At the Holiday Party this year, Eric Carter got up to sing karaoke and astounded us all with a bouncy rendition of “Sesame Street.” &lt;/p&gt;  &lt;p&gt;-Christin Boyd, Program Manager, Visual Studio&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9594976" 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/Christin+Boyd/default.aspx">Christin Boyd</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/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Community/default.aspx">Community</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Office+Development/default.aspx">Office Development</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Visual+Studio+2010/default.aspx">Visual Studio 2010</category></item><item><title>Video How Do I: Add Controls at Run Time in an Application-Level Project (Mary Lee)</title><link>http://blogs.msdn.com/vsto/archive/2009/03/10/video-how-do-i-add-controls-at-run-time-in-an-application-level-project-mary-lee.aspx</link><pubDate>Tue, 10 Mar 2009 18:59:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9469226</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9469226.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9469226</wfw:commentRss><description>&lt;p&gt;In &lt;a href="http://msdn.microsoft.com/en-us/library/cc442817.aspx"&gt;Walkthrough: Adding Controls to a Worksheet at Run Time in an Application-Level Project&lt;/a&gt;, you can see&amp;#160; to add host controls at run time in an application-level add-in by using Visual Studio 2008 SP1.&amp;#160; This video is posted to the &lt;a href="http://msdn.microsoft.com/en-us/vbasic/bb466226.aspx"&gt;How Do I Videos - Visual Basic&lt;/a&gt; page, part of the Visual Basic Developer Center.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vbasic/dd551271.aspx"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/VideoHowDoIAddControlsatRunTimeinanAppli_A36A/image_3.png" width="300" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vbasic/dd551271.aspx"&gt;How Do I: Add Controls to a Worksheet at Run Time in an Application-Level Project?&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Mary Lee, Programming Writer.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9469226" 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/Mary+Lee/default.aspx">Mary Lee</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/Excel+2007/default.aspx">Excel 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/SP1/default.aspx">SP1</category></item><item><title>Why Can’t I Change the Update Path when Redeploying VSTO Solutions? (Christin Boyd, Kris Makey, Jeff Young)</title><link>http://blogs.msdn.com/vsto/archive/2008/12/16/why-can-t-i-change-the-update-path-when-redeploying-vsto-solutions-christin-boyd-kris-makey-jeff-young.aspx</link><pubDate>Wed, 17 Dec 2008 01:45:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9228873</guid><dc:creator>VSTO Team</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9228873.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9228873</wfw:commentRss><description>&lt;p&gt;The other day I was asked about the automatic Updates feature of VSTO 3.0 deployment.&amp;nbsp; In this scenario, he used the Publish Wizard in VS 2008 to create a Word document solution and the install manifest.&amp;nbsp;&amp;nbsp; Then a bunch of people used the Word document, and kicked off the installer which then copied things to their ClickOnce cache.&amp;nbsp; Everything worked fine.&amp;nbsp; Then he needed to make changes to the code, recompile, and somehow get the solution to all of his customers.&amp;nbsp; Instead of using the Publish Wizard to create the update in the same server, he chose to use a different server path.&amp;nbsp; The customers were unable to install the updates.&amp;nbsp; He tried editing the custom properties of the document to change the install path to the new server, but it still didn’t work.&amp;nbsp; Then he tried testing with a new, clean computer, and on that computer he was able to install from the new path and use the new Word document.&amp;nbsp; He asked us why were the “old” users unable to get the update? &lt;p&gt;This question shows up on the Forum occasionally.&amp;nbsp; “Why can I not change the update location of VSTO v3 Add-in or Document once it is installed?”&amp;nbsp; (Or) “Why does VSTO continue to check in the old location even after I change location property on client machines that installed the old version?” &lt;p&gt;The Path to the deployment manifest is used as part of the Identity for an Add-in.&amp;nbsp; During the First installation of an Add-in or Document, the Full Path is set and stored by the VSTO Runtime for that client machine.&amp;nbsp; Once you have installed an Add-in changing the path in the registration will cause the Add-in to throw an Error.&amp;nbsp; Once you have installed a customized Document, the code-behind will only check the original location and changes to the path stored in the document will be ignored (this is to allow copying a local version of a customized document that you installed from a remote location).&amp;nbsp; In order to change the location that an Add-in or Document checks for updates, you must First uninstall the “old” version on the installed clients and then install from the new location.&amp;nbsp; &lt;p&gt;Now, if you want to delve deeper, then keep reading this paragraph, or skip to the next one.&amp;nbsp; The low-level explanation is that ClickOnce uses the solution path as part of its identity when storing solutions into the ClickOnce cache.&amp;nbsp;&amp;nbsp; You will get &lt;i&gt;similar&lt;/i&gt; behavior in a CO-deployed Windows Application as well _&lt;i&gt;unless&lt;/i&gt;_ you use the deploymentProviderURL (DPURL).&amp;nbsp; Setting the DPURL can allow WinForms applications to change where updates are pulled from so that Server A (from which a solution was original installed) can be decommissioned and updates can be retrieved from Server B.&amp;nbsp; VSTO does not support DPURL.&amp;nbsp; Why not, you ask?&amp;nbsp; At the time we were considering it during the development of VS 2008, the amount of development work-months required was more than the time we had remaining (DPURL has implications on migration of data from old solution to new solution, for instance).&amp;nbsp; After much discussion, we decided to have the ClickOnce team throw an exception of a DPURL is set for VSTO solutions.&amp;nbsp; At the start of development for VS 2010, we considered this feature again, but again this feature did not make our list of highest priority deployment features.&amp;nbsp; We are implementing a lot of new deployment features for VS 2010. &lt;p&gt;In conclusion, the solution Path is used as part of the identity.&amp;nbsp; You can’t change the update path after you've installed an Office solution.&amp;nbsp; In a Windows solution, you can change the update path using DPURL.&amp;nbsp; VSTO doesn’t support DPURL because we couldn’t fit that feature in the development schedule.&amp;nbsp; The workaround is to uninstall the solution from the user’s computer when it is stuck pointing to an old path that you can’t update anymore and then reinstall with a new Install Path set in the Publish wizard.&amp;nbsp; We recommend that you set your Install Path to a URL that you predict can stay the same for as long as your users will need updates. &lt;p&gt;This explanation applies to Word document and template solutions, and to Excel spreadsheet and template solutions. &lt;p&gt;I hope this blog entry is helpful!&amp;nbsp; Please leave comments to this article if you have feedback.&amp;nbsp; &lt;p&gt;-Kris Makey, Jeff Young, Christin Boyd, Mary Lee and Saurabh Bhatia contributed to this blog post&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9228873" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/ClickOnce/default.aspx">ClickOnce</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Christin+Boyd/default.aspx">Christin Boyd</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/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VS2008/default.aspx">VS2008</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Manifest/default.aspx">Manifest</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Add+Remove+Programs/default.aspx">Add Remove Programs</category></item><item><title>How Do I: Deploy Document-Level Office 2007 Solutions with Windows Installer? (Mary Lee)</title><link>http://blogs.msdn.com/vsto/archive/2008/10/02/how-do-i-deploy-document-level-office-2007-solutions-with-windows-installer-mary-lee.aspx</link><pubDate>Thu, 02 Oct 2008 19:26:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8973866</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8973866.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8973866</wfw:commentRss><description>&lt;p&gt;In &lt;a href="http://blogs.msdn.com/vsto/archive/2008/04/10/deploying-an-office-solution-using-windows-installer-mary-lee.aspx"&gt;Deploying an Office solution using Windows Installer&lt;/a&gt;, you read how to deploy document-level Office 2007 solutions with Windows Installer.&amp;#160; As a follow up, you can now &lt;em&gt;see&lt;/em&gt; how to add a Setup project to your VSTO solution and add a custom action to update custom document properties. This example uses Excel 2007, but you can apply these principles to any document-level customization.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vcsharp/cc998641.aspx"&gt;Deploying Excel Document-level Customizations with Windows Installer&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vcsharp/cc998641.aspx"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="183" alt="MSI2" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HowDoIDeployDocumentLevelOffice2007Solut_848D/MSI2_1.jpg" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This video is based on the whitepaper: &lt;a href="http://msdn.microsoft.com/en-us/library/cc616991.aspx"&gt;Deploying a Visual Studio Tools for the Office System 3.0 Solution for the 2007 Microsoft Office System Using Windows Installer (Part 2 of 2)&lt;/a&gt;, where you can get the code and follow along step-by-step.&lt;/p&gt;  &lt;p&gt;Mary Lee, Programming Writer.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8973866" 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/Mary+Lee/default.aspx">Mary Lee</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/vsto/archive/tags/MSI/default.aspx">MSI</category><category domain="http://blogs.msdn.com/vsto/archive/tags/video/default.aspx">video</category></item><item><title>How Do I: Deploy Application-Level Office 2007 Solutions with Windows Installer? (Mary Lee)</title><link>http://blogs.msdn.com/vsto/archive/2008/10/02/how-do-i-deploy-application-level-office-2007-solutions-with-windows-installer-mary-lee.aspx</link><pubDate>Thu, 02 Oct 2008 19:21:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8973862</guid><dc:creator>VSTO Team</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8973862.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8973862</wfw:commentRss><description>&lt;p&gt;In &lt;a href="http://blogs.msdn.com/vsto/archive/2008/04/10/deploying-an-office-solution-using-windows-installer-mary-lee.aspx"&gt;Deploying an Office solution using Windows Installer&lt;/a&gt;, you read how to deploy application-level Office 2007 solutions with Windows Installer.&amp;#160; As a follow up, you can now &lt;em&gt;see&lt;/em&gt; how to add a Setup project to your VSTO solution and create registry keys. This example uses Excel 2007, but you can apply these principles to any application-level add-in.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vcsharp/cc998443.aspx"&gt;Deploying Excel Application-level Add-ins with Windows Installer&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/vcsharp/cc998443.aspx"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="184" alt="MSI1" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HowDoIDeployApplicationLevelOffice2007So_8364/MSI1_1.jpg" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This video is based on the whitepaper: &lt;a href="http://msdn.microsoft.com/en-us/library/cc563937.aspx"&gt;Deploying a Visual Studio Tools for the Office System 3.0 Solution for the 2007 Microsoft Office System Using Windows Installer (Part 1 of 2)&lt;/a&gt;, where you can get the code and follow along step-by-step.&lt;/p&gt;  &lt;p&gt;Mary Lee, Programming Writer.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8973862" 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/Mary+Lee/default.aspx">Mary Lee</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Windows+Installer/default.aspx">Windows Installer</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/vsto/archive/tags/MSI/default.aspx">MSI</category><category domain="http://blogs.msdn.com/vsto/archive/tags/video/default.aspx">video</category><category domain="http://blogs.msdn.com/vsto/archive/tags/add-ins/default.aspx">add-ins</category></item><item><title>How Do I: Add Smart Tags to Excel Workbooks? (Kathleen McGrath)</title><link>http://blogs.msdn.com/vsto/archive/2008/08/28/how-do-i-add-smart-tags-to-excel-workbooks-kathleen-mcgrath.aspx</link><pubDate>Fri, 29 Aug 2008 01:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8904266</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8904266.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8904266</wfw:commentRss><description>&lt;P&gt;With the release of Visual Studio 2008 SP1, you can now add smart tags to Excel by using an add-in.&amp;nbsp; In this video, I show you how to add them to both a document-level customization and an add-in project.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/vbasic/cc872866.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vbasic/cc872866.aspx"&gt;How Do I: Add Smart Tags to Excel Workbooks?&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/vbasic/cc872866.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vbasic/cc872866.aspx"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=301 alt=SmartTagsExcel src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HowDoIAddSmartTagstoExcelWorkbooks_D444/SmartTagsExcel_11.jpg" width=312 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HowDoIAddSmartTagstoExcelWorkbooks_D444/SmartTagsExcel_11.jpg"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;This video is based on the topic: &lt;A href="http://msdn.microsoft.com/en-us/library/ms178788.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ms178788.aspx"&gt;How to: Add Smart Tags to Excel Workbooks&lt;/A&gt;, where you can get the code and follow along step-by-step.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8904266" 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/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/video/default.aspx">video</category><category domain="http://blogs.msdn.com/vsto/archive/tags/SP1/default.aspx">SP1</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Kathleen+McGrath/default.aspx">Kathleen McGrath</category></item><item><title>Create an Excel Shortcut Menu That Writes Selected Values to a Text File (Harry Miller)</title><link>http://blogs.msdn.com/vsto/archive/2008/08/22/create-an-excel-shortcut-menu-that-writes-selected-values-to-a-text-file-harry-miller.aspx</link><pubDate>Fri, 22 Aug 2008 23:14:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8888730</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8888730.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8888730</wfw:commentRss><description>&lt;p&gt;It doesn't take much code to add a command to a shortcut menu in Excel, but the menu objects have strange names so it's not intuitive, to me at least. The trickiest part is just sorting out how it's supposed to work, because it seems like it should be different from adding buttons to toolbars, but it really looks like that's what you're doing.&lt;/p&gt;  &lt;p&gt;You can watch the video and make me happy, or you can just jump to the code example that's all given a little lower down. Thanks to McLean Schofield, programmer/writer and 3-star forum answer person, for this code example!&lt;/p&gt;  &lt;p&gt;Duration: 3 minutes, 50 seconds.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:01d81165-79b0-49d5-baf0-2678a43cbf83" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;div id="3e6cb28d-5797-43d6-b2c8-746d5c8505b8" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://video.msn.com/video.aspx?vid=a927908c-e0dc-4a9e-8b59-faeeabe0cbbc&amp;amp;from=writer" target="_new"&gt;&lt;img src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/CreateanExcelShortcutMenuThatWritesSelec_B7C0/videofece4865a6bc.jpg" galleryimg="no" onload="var downlevelDiv = document.getElementById('3e6cb28d-5797-43d6-b2c8-746d5c8505b8'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;embed src=\&amp;quot;http://images.video.msn.com/flash/soapbox1_1.swf\&amp;quot; quality=\&amp;quot;high\&amp;quot; width=\&amp;quot;432\&amp;quot; height=\&amp;quot;364\&amp;quot; wmode=\&amp;quot;transparent\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; pluginspage=\&amp;quot;http://macromedia.com/go/getflashplayer\&amp;quot; flashvars=\&amp;quot;c=v&amp;amp;v=a927908c-e0dc-4a9e-8b59-faeeabe0cbbc&amp;amp;from=writer\&amp;quot; &amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Public Class ThisAddIn &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Private WithEvents writeToText As Office.CommandBarButton   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Private selectedCells As Excel.Range &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Private Sub ThisAddIn_Startup(ByVal sender _   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; As Object, ByVal e As System.EventArgs) Handles Me.Startup &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; DefineShortcutMenu()   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; End Sub &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Private Sub DefineShortcutMenu() &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Dim menuItem As Office.MsoControlType = Office.MsoControlType.msoControlButton   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writeToText = Application.CommandBars(&amp;quot;Cell&amp;quot;).Controls.Add(Type:=menuItem, _    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Before:=1, Temporary:=True) &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writeToText.Style = Office.MsoButtonStyle.msoButtonCaption   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writeToText.Caption = &amp;quot;Write to a Text File&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writeToText.Tag = &amp;quot;0&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; End Sub &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Private Sub Application_SheetBeforeRightClick(ByVal Sh _   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; As Object, ByVal Target As Microsoft.Office.Interop.Excel.Range, _    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ByRef Cancel As Boolean) Handles Application.SheetBeforeRightClick &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; selectedCells = Target   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; End Sub &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; Private Sub writeToText_Click(ByVal Ctrl As Office.CommandBarButton, _   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ByRef CancelDefault As Boolean) Handles writeToText.Click &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Try   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Dim currentDateTime As System.DateTime = _    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.DateTime.Now    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Dim dateStamp As String = _    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; currentDateTime.ToString(&amp;quot;dMMMMyyyy_hh.mm.ss&amp;quot;) &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Dim fileName As String = System.Environment.GetFolderPath( _   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Environment.SpecialFolder.MyDocuments) &amp;amp; &amp;quot;\\&amp;quot; &amp;amp; _    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; dateStamp &amp;amp; &amp;quot;.txt&amp;quot;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter(fileName) &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; For Each cell As Excel.Range In selectedCells.Cells   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; If cell.Value2 IsNot Nothing Then    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sw.WriteLine(cell.Value2.ToString())    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; End If    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Next    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sw.Close()    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Catch ex As Exception    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Windows.Forms.MessageBox.Show(ex.Message)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; End Try &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; End Sub&lt;/p&gt;  &lt;p&gt;End Class&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8888730" width="1" height="1"&gt;</description><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/McLean+Schofield/default.aspx">McLean Schofield</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Harry+Miller/default.aspx">Harry Miller</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/video/default.aspx">video</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>Peek at Service Pack 1 (Christin Boyd)</title><link>http://blogs.msdn.com/vsto/archive/2008/05/11/peek-at-service-pack-1-christin-boyd.aspx</link><pubDate>Mon, 12 May 2008 08:42:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8491913</guid><dc:creator>VSTO Team</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8491913.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8491913</wfw:commentRss><description>&lt;p&gt;Visual Studio 2008 Service Pack 1 is not finished yet, but we do have a beta version of the documentation ready for you to read!&amp;nbsp; You can learn about some of the features that you'll see later this year when we release SP1.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I recommend starting with reading about a totally new feature that we put into SP1 that allows you to extend Word documents and Excel Workbooks at runtime from an Application-Level Add-in.&amp;nbsp; Here is the link to the Beta of the documentation:&lt;/p&gt; &lt;p&gt;&lt;a href="http://vs2008sp1docs.msdn.microsoft.com/en-us/ms334311.aspx"&gt;http://vs2008sp1docs.msdn.microsoft.com/en-us/ms334311.aspx&lt;/a&gt;&lt;/p&gt; &lt;p&gt;You'll be able to create objects and respond to events including:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Host Controls  &lt;li&gt;ListObjects  &lt;li&gt;Smart Tags  &lt;li&gt;Word Content Controls  &lt;li&gt;and Events such as DocumentBeforeSave&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Only some of the new deployment features have been documented so far.&amp;nbsp; You can read about one of the new deployment features in the &lt;a href="http://vs2008sp1docs.msdn.microsoft.com/en-us/ms331997.aspx" target="_blank"&gt;Event Logging (2007 System)&lt;/a&gt; page in the SP1 documentation here:&lt;/p&gt; &lt;p&gt;&lt;a title="http://vs2008sp1docs.msdn.microsoft.com/en-us/ms331997.aspx" href="http://vs2008sp1docs.msdn.microsoft.com/en-us/ms331997.aspx"&gt;http://vs2008sp1docs.msdn.microsoft.com/en-us/ms331997.aspx&lt;/a&gt;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Starting in Visual Studio 2008 Service Pack 1 (SP1), you can use the event viewer in Windows to see error messages that are captured by the Visual Studio Tools for Office runtime when you install or uninstall Visual Studio Tools for Office solutions. You can use these messages from the event logger to resolve installation and deployment problems.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;The Beta version of the Service Pack is only getting distributed to about a thousand beta testers who have great reputations for submitting clear feedback and bug reports.&amp;nbsp; I hope this little peek at the documentation will get you excited about what's coming later this summer in Service Pack 1. &lt;/p&gt; &lt;p&gt;-Christin Boyd, Program Manager&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8491913" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/ClickOnce/default.aspx">ClickOnce</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VSTO/default.aspx">VSTO</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Christin+Boyd/default.aspx">Christin Boyd</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/Word+2007/default.aspx">Word 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Excel+2007/default.aspx">Excel 2007</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx">Deployment</category><category domain="http://blogs.msdn.com/vsto/archive/tags/smart+tags/default.aspx">smart tags</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Databinding best practices for Excel (Christin Boyd)</title><link>http://blogs.msdn.com/vsto/archive/2008/04/14/databinding-best-practices-for-excel-christin-boyd.aspx</link><pubDate>Tue, 15 Apr 2008 07:14:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8396399</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8396399.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8396399</wfw:commentRss><description>&lt;P&gt;I read a question on the forum about databinding in an Excel solution.&amp;nbsp; The developer was asking about Excel 2003, but the answer I wrote will work for both Excel 2003 and Excel 2007.&amp;nbsp; Here's the question:&amp;nbsp; &lt;A href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3122341&amp;amp;SiteID=1&amp;amp;mode=1" mce_href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3122341&amp;amp;SiteID=1&amp;amp;mode=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3122341&amp;amp;SiteID=1&amp;amp;mode=1&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;As a best practice you can create one dataset in ThisWorkbook designer and then programmatically reference it from your code in other sheets. &lt;/P&gt;
&lt;P&gt;Here’s how: &lt;/P&gt;
&lt;P&gt;Add new Data Source of Data Base type, by specifying a database connection and selecting tables, views and columns. &lt;/P&gt;
&lt;P&gt;Next open ThisWorkbook.vb in the designer.&amp;nbsp; It will look like it's a big gray box with two sentences that say "This is the workbook designer...."&amp;nbsp; Now from the Toolbox, under the Data section, select a DataSet and drag it onto the design surface.&amp;nbsp; When you drop it, you will get a dialog that asks if you want a typed or untyped dataset.&amp;nbsp; Select Typed.&amp;nbsp; It should prepopulate an edit box with &amp;lt;your namespace&amp;gt;.MyDataSet.&amp;nbsp; Click OK.&amp;nbsp; On the design surface you should now see an icon next to MyDataSet1.&amp;nbsp; In C# you will want to set the modifier to Internal or Public on the data set in the property browser. &lt;/P&gt;
&lt;P&gt;Next open the code behind ThisWorkbook.vb.&amp;nbsp; Inside the ThisWorkbook_Startup&amp;nbsp; procedure, you should fill your MyDataSet1 instance with code like this: &lt;/P&gt;
&lt;P&gt;VB Sample &lt;/P&gt;&lt;FONT face="courier new"&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt;patientAdapter &lt;FONT color=#0000ff size=2&gt;As New&lt;/FONT&gt; MyDataSetTableAdapters.PatientsTableAdapter&lt;BR&gt;&amp;nbsp;&amp;nbsp;patientAdapter.Fill(&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;.MyDataSet1.Patients)&amp;nbsp;&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;Dim&lt;/FONT&gt; rxAdapter &lt;FONT color=#0000ff size=2&gt;As New&lt;/FONT&gt; MyDataSetTableAdapters.PrescriptionsTableAdapter&lt;BR&gt;&amp;nbsp;&amp;nbsp;rxAdapter.Fill(&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;.MyDataSet1.Prescriptions) &lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;C# sample &lt;/P&gt;&lt;FONT face="courier new"&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;MyDataSetTableAdapters.PatientsTableAdapter ta = &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;new&lt;/FONT&gt; MyDataSetTableAdapters.PatientsTableAdapter();&lt;BR&gt;&amp;nbsp;&amp;nbsp;ta.Fill(myDataSet1.Patients);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Next you can open Sheet1 designer.&amp;nbsp; Now select "Add New Data Source" from the data menu and this time choose to add an "Object" not a database!&amp;nbsp; You will get a dialog that shows the hierarchy and this time DO NOT select the table adapter!&amp;nbsp; Open the name of your project, then the namespace, then you should see MyDataSet. Select it then click OK.&amp;nbsp; This action will create an Object in your Data Sources window. &lt;/P&gt;
&lt;P&gt;Now you can select from the Data Sources Window, you should see something called MyDataSet.&amp;nbsp; This object can be used to create a databinding in your sheets.&amp;nbsp; So you can drag from this universal object into any one of your sheets.&amp;nbsp; Grab it and drag it onto Excel Sheet1 and it created an empty table. In order to finish setting it up, select the table and in the property grid click on the arrow next to DataMember property and select the data table that you want to be bound to the table. Try it, and see how it creates a new BindingSource object for each sheet, but you still have just the one DataSet instance.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;In each Sheet, you need to add the following line of code for Each table: &lt;/P&gt;&lt;FONT face="courier new"&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff size=2&gt;Me&lt;/FONT&gt;.PatientsDataTableBindingSource.DataSource = Globals.ThisWorkbook.MyDataSet1 &lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;Please let me know through comments on this blog if this explanation works for you.&amp;nbsp; Thank you!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8396399" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/vsto/archive/tags/Christin+Boyd/default.aspx">Christin Boyd</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Data/default.aspx">Data</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><category domain="http://blogs.msdn.com/vsto/archive/tags/TableAdapter/default.aspx">TableAdapter</category><category domain="http://blogs.msdn.com/vsto/archive/tags/DataSet/default.aspx">DataSet</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx">VB</category><category domain="http://blogs.msdn.com/vsto/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Visual Studio Command Bar for Arranging Controls on Documents and Worksheets (McLean Schofield)</title><link>http://blogs.msdn.com/vsto/archive/2008/04/10/visual-studio-command-bar-for-arranging-controls-on-documents-and-worksheets.aspx</link><pubDate>Fri, 11 Apr 2008 00:05:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8376521</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8376521.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8376521</wfw:commentRss><description>&lt;P&gt;One of the lesser-known features of Visual Studio Tools for Office is the &lt;STRONG&gt;Microsoft Office Word&lt;/STRONG&gt; and &lt;STRONG&gt;Microsoft Office Excel&lt;/STRONG&gt; command bar. When you are developing a document-level project for Word or Excel (for example, a Word Document or Excel Workbook project) and you have the document or one of your worksheets open in the designer, this command bar appears in Visual Studio, just above the designer. In Excel, this command bar looks like the following by default. 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_10.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_10.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=168 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_1.png" width=497 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_1.png"&gt;&lt;/A&gt;&amp;nbsp; 
&lt;P&gt;The first several buttons in this command bar are for changing the keyboard scheme and mapping XML to the document or worksheet. This post is about the purpose of the rest of the buttons. 
&lt;P&gt;If you are designing a custom UI for your document or worksheet that includes Windows Forms controls that you add by using the designer, you can use these buttons to arrange the controls with a single click. When you select multiple controls in the designer, these buttons become enabled. 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image16.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image16.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=37 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image16_thumb.png" width=263 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image16_thumb.png"&gt;&lt;/A&gt;&amp;nbsp; 
&lt;P&gt;From left to right, here are the buttons you can use: 
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Lefts&lt;/STRONG&gt;. This button moves all of the controls to the left, so that they are aligned with the left side of the left-most control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Centers&lt;/STRONG&gt;. This button moves all of the controls left or right so that they are aligned around the vertical axis of the widest control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Rights&lt;/STRONG&gt;. This button moves all of the controls to the right, so that they are aligned with the right side of the right-most control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Tops&lt;/STRONG&gt;. This button moves all of the controls up, so that they are aligned with the top side of the upper-most control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Middles&lt;/STRONG&gt;. This button moves all of the controls up or down, so that they are aligned around the horizontal axis of the tallest control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Align Bottoms&lt;/STRONG&gt;. This button moves all of the controls down, so that they are aligned with the bottom side of the bottom-most control.&lt;/P&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Make Horizontal Spacing Equal&lt;/STRONG&gt;. The left-most and right-most control remain in place; the controls in between move horizontally so that there is equal horizontal space between each control.&lt;/P&gt;
&lt;LI&gt;&lt;STRONG&gt;Make Vertical Spacing Equal&lt;/STRONG&gt;. The top-most and bottom-most control remain in place; the controls in between move vertically so that there is equal vertical space between each control.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;A special note about Word.&lt;/STRONG&gt; In Word projects, the alignment buttons are enabled only if the selected controls are &lt;EM&gt;not&lt;/EM&gt; in line with text. By default, controls that you add to a Word document at design time are in line with text. To change the layout style of the control, right-click the control and then click &lt;STRONG&gt;Format Control&lt;/STRONG&gt;. Then, on the &lt;STRONG&gt;Layout&lt;/STRONG&gt; tab, select a wrapping style other than &lt;STRONG&gt;In line with text&lt;/STRONG&gt;:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image55.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image55.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=202 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image55_thumb.png" width=461 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image55_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Examples.&lt;/STRONG&gt; Enough words! Here are some examples that show these alignment options in action. These examples are pretty contrived, but they should give you an idea of the effects of each option.&lt;/P&gt;
&lt;P&gt;Given the following buttons on a worksheet:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image19.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image19.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=232 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image19_thumb.png" width=384 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image19_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Align Lefts&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_16.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_16.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_7.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_7.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Align Centers&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_18.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_18.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_8.png" width=238 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_8.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;And &lt;STRONG&gt;Align Rights&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_20.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_20.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=244 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_9.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image_thumb_9.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Given the following buttons on a worksheet:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image40.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image40.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=221 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image40_thumb.png" width=398 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image40_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Align Tops&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image43.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image43.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=116 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image43_thumb.png" width=400 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image43_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Align Middles&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image37.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image37.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=136 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image37_thumb.png" width=406 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image37_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;And &lt;STRONG&gt;Align Bottoms&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image46.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image46.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=134 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image46_thumb.png" width=400 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image46_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Given the following buttons on a worksheet:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image49.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image49.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=56 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image49_thumb.png" width=566 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image49_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Make Horizontal Spacing Equal&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image52.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image52.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=54 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image52_thumb.png" width=576 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image52_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Finally, given the following buttons on a worksheet:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image64.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image64.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=306 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image64_thumb.png" width=173 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image64_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Make Vertical Spacing Equal&lt;/STRONG&gt; rearranges the controls as follows:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image67.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image67.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=297 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image67_thumb.png" width=186 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/HiddenVSTOFeature_9861/image67_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope these options come in handy then next time you are adding controls to a document or worksheet in VSTO.&lt;/P&gt;
&lt;P&gt;-------------------------------------------------&lt;/P&gt;
&lt;P&gt;McLean Schofield, Programming Writer&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8376521" width="1" height="1"&gt;</description><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/McLean+Schofield/default.aspx">McLean Schofield</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/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/Excel+2007/default.aspx">Excel 2007</category></item></channel></rss>