<?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 : VB</title><link>http://blogs.msdn.com/vsto/archive/tags/VB/default.aspx</link><description>Tags: VB</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>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>New "How Do I" Video on Creating Smart Tags in Word (Beth Massi)</title><link>http://blogs.msdn.com/vsto/archive/2008/12/18/new-how-do-i-video-on-creating-smart-tags-in-word-beth-massi.aspx</link><pubDate>Thu, 18 Dec 2008 20:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9232517</guid><dc:creator>VSTO Team</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9232517.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9232517</wfw:commentRss><description>&lt;P&gt;Our very own &lt;A href="http://blogs.msdn.com/vsto/archive/tags/Mary+Lee/default.aspx" target=_blank mce_href="http://blogs.msdn.com/vsto/archive/tags/Mary+Lee/default.aspx"&gt;Mary Lee&lt;/A&gt; has &lt;A href="http://msdn.microsoft.com/en-us/vsto/dd347826.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vsto/dd347826.aspx"&gt;got a new video&lt;/A&gt; up on the &lt;A href="http://msdn.com/vsto" target=_blank mce_href="http://msdn.com/vsto"&gt;Dev Center&lt;/A&gt; on programming smart tags in with custom recognizers in Word using &lt;A href="http://msdn.microsoft.com/en-us/vstudio/products/cc533448.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vstudio/products/cc533448.aspx"&gt;Visual Studio 2008 Service Pack 1&lt;/A&gt;. This is a video version of the &lt;A href="http://msdn.microsoft.com/en-us/library/ms268751.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/ms268751.aspx"&gt;How To topic in the MSDN library&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://msdn.microsoft.com/en-us/vsto/dd347826.aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/vsto/dd347826.aspx"&gt;&lt;STRONG&gt;Watch or download the video here.&lt;/STRONG&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Thanks Mary!&lt;/P&gt;
&lt;P&gt;Enjoy,&lt;BR&gt;-&lt;A href="http://blogs.msdn.com/bethmassi" target=_blank mce_href="http://blogs.msdn.com/bethmassi"&gt;Beth Massi&lt;/A&gt;, Visual Studio Community&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9232517" width="1" height="1"&gt;</description><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/Word+2007/default.aspx">Word 2007</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/video/default.aspx">video</category><category domain="http://blogs.msdn.com/vsto/archive/tags/Beth+Massi/default.aspx">Beth Massi</category></item><item><title>DevConnections Conference: VSTO Session Demos (Christin Boyd)</title><link>http://blogs.msdn.com/vsto/archive/2008/11/13/devconnections-conference-vsto-session-demos.aspx</link><pubDate>Fri, 14 Nov 2008 02:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9067851</guid><dc:creator>VSTO Team</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/vsto/comments/9067851.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=9067851</wfw:commentRss><description>&lt;P&gt;Hi Folks!&amp;nbsp; If you're not one of the 4,000 professionals attending DevConnections in Las Vegas, then never fear!&amp;nbsp; You can see my demos and learn about my session "Office Development with Visual Studio 2008" from this blog entry!&amp;nbsp; &lt;/P&gt;
&lt;P&gt;VS 2008 lets you target Office 2003 or Office 2007.&amp;nbsp; We recommend that you only install one version of Office on your development computer.&amp;nbsp; If you find yourself developing for both versions often, then I suggest creating a dual-boot computer with Office 2003 on one boot, and Office 2007 on the other.&amp;nbsp; If you develop mostly for one version, and occasionally target the other, then a Virtual PC image would be fine, if you have enough RAM.&amp;nbsp; I have 2Gig on my laptop, which is not enough for a VPC running Visual Studio.&amp;nbsp; My desktop computer back in Redmond has 4G, which is plenty.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/OfficeDeveloperConferenceDevelopingandDe_118D7/FileNewProject_2.jpg" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/OfficeDeveloperConferenceDevelopingandDe_118D7/FileNewProject_2.jpg"&gt;&lt;IMG height=105 alt=FileNewProject src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/OfficeDeveloperConferenceDevelopingandDe_118D7/FileNewProject_thumb.jpg" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/OfficeDeveloperConferenceDevelopingandDe_118D7/FileNewProject_thumb.jpg"&gt;&lt;/A&gt; 
&lt;P&gt;FAQ: If you choose to ignore my recommendation and have 2 versions of Office on your development computer, then you may have some weirdness when you try to Debug and the debugger loads the wrong versions of some Office DLLs.&amp;nbsp; If you try to open an Office 2003 project and you keep getting the Upgrade Wizard, and you don't want to, then uncheck the &lt;A href="http://channel9.msdn.com/posts/HarryMiller/Turn-Off-Automatic-Conversion-of-Office-2003-Projects-into-2007-Projects/" target=_blank mce_href="http://channel9.msdn.com/posts/HarryMiller/Turn-Off-Automatic-Conversion-of-Office-2003-Projects-into-2007-Projects/"&gt;"Always Upgrade" option in the Tools\Options dialog as shown in this funny video&lt;/A&gt; and in this photo below: 
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DevConnectionsConference_B627/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DevConnectionsConference_B627/image_2.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=143 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DevConnectionsConference_B627/image_thumb.png" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DevConnectionsConference_B627/image_thumb.png"&gt;&lt;/A&gt; 
&lt;H3&gt;Excel And Ribbon Demo&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Excel and Word templates let you program to the document surface 
&lt;LI&gt;Word Content Controls, Bookmarks 
&lt;LI&gt;Excel cells, Named Ranges, and Charts 
&lt;LI&gt;Your custom Ribbon tabs can scope to just one document 
&lt;LI&gt;Demo code:&amp;nbsp; &lt;A href="http://msdn2.microsoft.com/en-us/library/bb386198.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb386198.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb386198.aspx&lt;/A&gt; 
&lt;LI&gt;Try clicking on the outermost top edge of the Ribbon Designer and then setting the property "Start from Scratch" = True.&amp;nbsp;&amp;nbsp; Then add another Tab to the Ribbon Designer and set the ControlId = TabInsert and ControlType = Office and OfficeId = TabInsert as seen below:&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DevConnectionsConference_B627/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DevConnectionsConference_B627/image_4.png"&gt;&lt;IMG style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=228 alt=image src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DevConnectionsConference_B627/image_thumb_1.png" width=244 border=0 mce_src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/DevConnectionsConference_B627/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;H3&gt;&amp;nbsp;&lt;/H3&gt;
&lt;H3&gt;VBA interop with VB .NET&lt;/H3&gt;
&lt;P&gt;&lt;A href="http://channel9.msdn.com/posts/DanielMoth/VBA-interop-with-VSTO-managed-code-in-VS-2008/" target=_blank mce_href="http://channel9.msdn.com/posts/DanielMoth/VBA-interop-with-VSTO-managed-code-in-VS-2008/"&gt;Check out this really nice VBA Interop demo&lt;/A&gt; by my Scottish colleague, &lt;A href="http://www.danielmoth.com/Blog/2007/10/five-vsto-v30-in-vs2008-videos.html" target=_blank mce_href="http://www.danielmoth.com/Blog/2007/10/five-vsto-v30-in-vs2008-videos.html"&gt;The Moth&lt;/A&gt;!&amp;nbsp; &lt;/P&gt;
&lt;H3&gt;Databinding&lt;/H3&gt;
&lt;P&gt;This part of my demo failed on Tuesday because my security ticket had expired, which made my Windows Authentication login to the database fail.&amp;nbsp; The problem was that I last received an Active Directory authentication on Friday afternoon when I logged in to my domain in Redmond, Washington.&amp;nbsp; Then I flew to Vegas and worked on my laptop without logging in to the corporate domain.&amp;nbsp; By Tuesday afternoon my kerberos ticket had expired, which made my Windows Integrated Security database logins fail.&amp;nbsp; A failure like that in front of an audience of 100 people is an EPIC FAIL!&amp;nbsp; Oops. 
&lt;P&gt;In conclusion, I will in the future use SQL Authentication instead of Windows Authentication for demonstrations when I am on-the-road for conferences. 
&lt;UL&gt;
&lt;LI&gt;Demo code:&amp;nbsp; Databound Word Content Controls &lt;A href="http://msdn2.microsoft.com/en-us/library/bb157875.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb157875.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb157875.aspx&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Developing Outlook Add-Ins&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Multiple Document Interface 
&lt;LI&gt;Inspector Windows 
&lt;LI&gt;Folders and Forms 
&lt;LI&gt;Developer UI Elements 
&lt;UL&gt;
&lt;LI&gt;Ribbon and Menus 
&lt;LI&gt;Custom Task Panes 
&lt;LI&gt;Outlook Form Regions&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Outlook Task Pane Demo code: I used a variation on this code &lt;A href="http://msdn2.microsoft.com/en-us/library/bb772082.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb772082.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb772082.aspx&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://channel9.msdn.com/posts/DanielMoth/Outlook-Form-Regions-in-Visual-Studio-2008/" target=_blank mce_href="http://channel9.msdn.com/posts/DanielMoth/Outlook-Form-Regions-in-Visual-Studio-2008/"&gt;Outlook Form Region video&lt;/A&gt; by The Moth&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Deploying Office Solutions&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Office Security is crucial 
&lt;LI&gt;Office 2003 deployment is different from 2007 
&lt;LI&gt;Office 2003 deployment model in VS 2008 is the same as it was in VSTO 2005 
&lt;LI&gt;Office 2007 solution deployment is completely new technology in VS 2008 
&lt;UL&gt;
&lt;LI&gt;Leverages ClickOnce Cache 
&lt;LI&gt;ClickOnce Automatic Update and Rollback 
&lt;LI&gt;Prerequisites included in Setup &lt;BR&gt;(runtime and .NET Framework)&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Demo steps:&amp;nbsp; &lt;A href="http://msdn2.microsoft.com/en-us/library/bb608592.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/bb608592.aspx"&gt;http://msdn2.microsoft.com/en-us/library/bb608592.aspx&lt;/A&gt; 
&lt;LI&gt;Lots of session questions were about deployment and you can click on the Tag "Deployment" in this blog to see lots and lots of posts on the topic.&amp;nbsp; &lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Deployment Best Practices&lt;/H3&gt;
&lt;UL&gt;
&lt;LI&gt;Test your deployment on another computer that does NOT have Visual Studio installed 
&lt;LI&gt;I use a test matrix of Virtual PC images on an external hard drive&lt;/LI&gt;&lt;/UL&gt;
&lt;H3&gt;Conclusion&lt;/H3&gt;
&lt;P&gt;I hope this information is useful as a reference for those who attended my session and for those of you who were unable to attend.&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;P&gt;-Christin Boyd, Program Manager &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9067851" 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/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/OBA/default.aspx">OBA</category><category domain="http://blogs.msdn.com/vsto/archive/tags/VBA/default.aspx">VBA</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>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>Calling Into A VSTO Add-in From a COM Smart Tag (McLean Schofield)</title><link>http://blogs.msdn.com/vsto/archive/2008/05/07/calling-into-a-vsto-add-in-from-a-com-smart-tag.aspx</link><pubDate>Wed, 07 May 2008 23:38:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8466997</guid><dc:creator>VSTO Team</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8466997.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8466997</wfw:commentRss><description>&lt;p&gt;My &lt;a href="http://blogs.msdn.com/vsto/archive/2008/05/02/understanding-vsto-smart-tags-and-com-smart-tags-mclean-schofield.aspx"&gt;last post&lt;/a&gt; explained some of the differences between VSTO smart tags (that is, smart tags that you implement in a document-level solution for Word or Excel by using VSTO) and COM smart tags (that is, smart tags that you create by implementing COM interfaces provided by the smart tag SDK). If you are using VSTO to create application-level add-ins for Word or Excel, or add-ins for other applications that support smart tags, such as PowerPoint and Outlook, then you must use the smart tag SDK if you want to also create smart tags for these applications. The general recommendation is to create your smart tags in a separate assembly (or unmanaged DLL, if you wish).&lt;/p&gt; &lt;p&gt;At the end of the post, I mentioned that if you go this route, you can still call into the VSTO add-in from the COM smart tag. Any technology that enables you to communicate between application domains, such as &lt;a href="http://msdn.microsoft.com/en-us/library/72x4h507.aspx"&gt;.NET remoting&lt;/a&gt; or &lt;a href="http://msdn.microsoft.com/en-us/library/ms735119.aspx"&gt;Windows Communication Foundation&lt;/a&gt;, should work, with varying degrees of complexity. However, the easiest way to do use built-in APIs provided by VSTO and Office to expose an object in your add-in to the smart tag, and then to call into this object from the smart tag. &lt;/p&gt; &lt;h3&gt;Exposing an Object in Your Add-in to the Smart Tag&lt;/h3&gt; &lt;p&gt;Starting in VSTO 2005 SE, add-ins have been able to expose functionality to other Office solutions by overriding the &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.addin.requestcomaddinautomationservice.aspx"&gt;RequestComAddInAutomationService&lt;/a&gt; method. When your add-in is loaded, the VSTO runtime calls this method to give you an opportunity to return an object that want other Office solutions to use. For example, if your add-in can display a custom task pane that enables end users to navigate data, you can expose this feature to other solutions by defining a class with a method that displays the task pane, and then returning an instance of this class in your override of &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.addin.requestcomaddinautomationservice.aspx"&gt;RequestComAddInAutomationService&lt;/a&gt;. &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;Side-bar&lt;/em&gt;: COM add-ins that implement the &lt;a href="http://msdn.microsoft.com/en-us/library/extensibility.idtextensibility2.aspx"&gt;IDTExtensibility2&lt;/a&gt; interface directly can do the same thing. In the implementation of the &lt;a href="http://msdn.microsoft.com/en-us/library/extensibility.idtextensibility2.onconnection.aspx"&gt;OnConnection&lt;/a&gt; method, the add-in receives an object that represents the application's view of the add-in as the &lt;em&gt;AddInInst&lt;/em&gt; parameter. Although this parameter is typed as an object, for Office add-ins, this object is really a &lt;a href="http://msdn.microsoft.com/en-us/library/aa432084.aspx"&gt;COMAddIn&lt;/a&gt;. Inside the &lt;a href="http://msdn.microsoft.com/en-us/library/extensibility.idtextensibility2.onconnection.aspx"&gt;OnConnection&lt;/a&gt; method, the add-in can set the &lt;a href="http://msdn.microsoft.com/en-us/library/aa432315.aspx"&gt;COMAddIn.Object&lt;/a&gt; property to an object it wants to expose. When you override &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.addin.requestcomaddinautomationservice.aspx"&gt;RequestComAddInAutomationService&lt;/a&gt; in a VSTO add-in, fundamentally the same thing is going on under the covers, but this is all abstracted away from view. &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;The following code example demonstrates a simple implementation of &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.addin.requestcomaddinautomationservice.aspx"&gt;RequestComAddInAutomationService&lt;/a&gt;. This assumes that my VSTO add-in defines a class called &lt;em&gt;AddInUtilities&lt;/em&gt;, which I want other solutions to be able to use.&lt;/p&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private utilities As AddInUtilities &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier" size="2"&gt;Protected Overrides Function RequestComAddInAutomationService() As Object&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;If utilities Is Nothing Then&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;utilities = New AddInUtilities()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End If&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Return utilities&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End Function&lt;/font&gt;&lt;/p&gt; &lt;p&gt;It is important to understand that you can't return just any object. Your object must be in an instance of a class that is visible to COM, and that exposes the &lt;a href="http://msdn.microsoft.com/en-us/library/ms221608(VS.85).aspx"&gt;IDispatch&lt;/a&gt; interface. One way to meet these requirements is to first define a COM-visible interface that exposes &lt;a href="http://msdn.microsoft.com/en-us/library/ms221608(VS.85).aspx"&gt;IDispatch&lt;/a&gt;. You should define this interface in its own assembly (for example, a class library project), so that the VSTO add-in and the smart tag assembly can both reference the same interface declaration. The following example demonstrates a simple &lt;em&gt;IAddInUtilities&lt;/em&gt; interface that defines a method called &lt;em&gt;DisplayData&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier" size="2"&gt;&amp;lt;System.Runtime.InteropServices.ComVisibleAttribute(True)&amp;gt; _&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&amp;lt;System.Runtime.InteropServices.InterfaceType( _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;ComInterfaceType.InterfaceIsIDispatch)&amp;gt; _&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Public Interface IAddInUtilities&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Sub DisplayData()&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End Interface&lt;/font&gt;  &lt;p&gt;Then, in your VSTO add-in that references the assembly that declares &lt;em&gt;IAddInUtilities&lt;/em&gt;, you can define a COM-visible class that implements the &lt;em&gt;IAddInUtilities&lt;/em&gt; interface. The actual code in the &lt;em&gt;DisplayData&lt;/em&gt; implementation isn't important for this discussion, so I'll leave it out for clarity.&lt;/p&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier" size="2"&gt;&amp;lt;System.Runtime.InteropServices.ComVisibleAttribute(True)&amp;gt; _&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&amp;lt;System.Runtime.InteropServices.ClassInterface( _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;System.Runtime.InteropServices.ClassInterfaceType.None)&amp;gt; _&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Public Class AddInUtilities&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Implements IAddInUtilities &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Public Sub DisplayData() Implements IAddInUtilities.DisplayData &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;' Do stuff here. &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End Sub&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End Class&lt;/font&gt; &lt;p&gt;For more specific details about the requirements for the object you return in &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.addin.requestcomaddinautomationservice.aspx"&gt;RequestComAddInAutomationService&lt;/a&gt;, see &lt;a href="http://msdn.microsoft.com/en-us/library/bb608621.aspx"&gt;Calling Code in Application-Level Add-ins from Other Office Solutions&lt;/a&gt;. For a walkthrough that demonstrates how to expose an object in a VSTO add-in and then call into the object from VBA code in an Excel workbook, see &lt;a href="http://msdn.microsoft.com/en-us/library/bb608614.aspx"&gt;Walkthrough: Calling Code in an Application-Level Add-in from VBA&lt;/a&gt;.&lt;/p&gt; &lt;h3&gt;Accessing the Object From a COM Smart Tag&lt;/h3&gt; &lt;p&gt;When you create a COM smart tag, you must implement the &lt;a href="http://msdn.microsoft.com/en-us/library/aa207016(office.11).aspx"&gt;ISmartTagRecognizer&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/aa206982(office.11).aspx"&gt;ISmartTagAction&lt;/a&gt; interfaces. Of these, &lt;a href="http://msdn.microsoft.com/en-us/library/aa206982(office.11).aspx"&gt;ISmartTagAction&lt;/a&gt; defines a specific action that the end user can select when they click your smart tag. This is a likely place to want to call into your VSTO add-in. The question is, how do you do this?&lt;/p&gt; &lt;p&gt;When the user clicks the icon to run an action, your implementation of the &lt;a href="http://msdn.microsoft.com/en-us/library/aa206924(office.11).aspx"&gt;ISmartTagAction.InvokeVerb&lt;/a&gt; method contains the code that you want to run. The &lt;em&gt;Target&lt;/em&gt; parameter of this method is an application-specific object that represents the context in which the smart tag appears. For example, in Excel, the &lt;em&gt;Target&lt;/em&gt; parameter is a &lt;a href="http://msdn.microsoft.com/en-us/library/bb178282.aspx"&gt;Range&lt;/a&gt; that identifies the cell that the smart tag was attached to.&lt;/p&gt; &lt;p&gt;In your implementation of &lt;a href="http://msdn.microsoft.com/en-us/library/aa206924(office.11).aspx"&gt;ISmartTagAction.InvokeVerb&lt;/a&gt;, you can cast the &lt;em&gt;Target&lt;/em&gt; parameter to the appropriate object in the object model of the application. From there, you can easily traverse the application's object model to get the Application object, then the &lt;a href="http://msdn.microsoft.com/en-us/library/aa432084.aspx"&gt;COMAddIn&lt;/a&gt; object for your VSTO add-in, and then finally the &lt;a href="http://msdn.microsoft.com/en-us/library/aa432315.aspx"&gt;Object&lt;/a&gt; property that contains the object you exposed in the add-in.&lt;/p&gt; &lt;p&gt;The following example demonstrates a simple implementation of &lt;a href="http://msdn.microsoft.com/en-us/library/aa206924(office.11).aspx"&gt;InvokeVerb&lt;/a&gt;. If the recognized term is &lt;em&gt;sale&lt;/em&gt;, then this method calls a helper method named &lt;em&gt;CallAddIn&lt;/em&gt;, and passes the &lt;em&gt;Target&lt;/em&gt; parameter to this helper method.&lt;/p&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier" size="2"&gt;Public Sub InvokeVerb(ByVal VerbID As Integer, _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;ByVal AppplicationName As String, _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;ByVal Target As Object, ByVal Properties As ISmartTagProperties, _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;ByVal Text As String, ByVal Xml As String) _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Implements ISmartTagAction.InvokeVerb &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;If String.Compare("sale", Text, True) = 0 Then&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Select Case VerbID&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Case 1&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;CallAddIn(Target)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End Select&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End If&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End Sub&lt;/font&gt;  &lt;p&gt;Here is the definition of the &lt;em&gt;CallAddIn&lt;/em&gt; helper method. &lt;/p&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font face="Courier" size="2"&gt;Private Sub CallAddIn(ByVal Target As Object)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Dim ExcelApp As Microsoft.Office.Interop.Excel.Application = Nothing &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;If Target IsNot Nothing Then&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Dim SmartTagRange As Microsoft.Office.Interop.Excel.Range = _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;TryCast(Target, Microsoft.Office.Interop.Excel.Range) &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;If SmartTagRange IsNot Nothing Then&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;ExcelApp = SmartTagRange.Application&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End If&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End If &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;If ExcelApp IsNot Nothing Then&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Dim AddIn As Microsoft.Office.Core.COMAddIn = ExcelApp.COMAddIns( _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;"ExcelSmartTagInteropDemo")&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Dim Utilities As AddInInterfaces.IAddInUtilities = _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;TryCast(AddIn.Object, AddInInterfaces.IAddInUtilities) &lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;If Utilities IsNot Nothing Then&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;Utilities.DisplayData()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End If&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End If&lt;br&gt;&lt;font face="Courier" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;End Sub&lt;/font&gt; &lt;p&gt;&lt;font face="Courier" size="2"&gt;&lt;/font&gt; &lt;p&gt;This method tries to cast the &lt;em&gt;Target&lt;/em&gt; parameter to an Excel &lt;a href="http://msdn.microsoft.com/en-us/library/bb178282.aspx"&gt;Range&lt;/a&gt;. If successful, the method gets the Excel &lt;a href="http://msdn.microsoft.com/en-us/library/bb210077.aspx"&gt;Application&lt;/a&gt; object, and then uses the &lt;a href="http://msdn.microsoft.com/en-us/library/bb177376.aspx"&gt;COMAddIns&lt;/a&gt; property to get the &lt;a href="http://msdn.microsoft.com/en-us/library/aa432084.aspx"&gt;COMAddIn&lt;/a&gt; that represents a loaded VSTO add-in with the name &lt;em&gt;ExcelSmartTagInteropDemo&lt;/em&gt;. Finally, the method gets the &lt;a href="http://msdn.microsoft.com/en-us/library/aa432315.aspx"&gt;Object&lt;/a&gt; property, tries to cast it to an &lt;em&gt;IAddInUtilities&lt;/em&gt;, and then calls the &lt;em&gt;DisplayData&lt;/em&gt; method implemented by the add-in. This of course assumes that the smart tag assembly references the assembly in which the &lt;em&gt;IAddInUtilities&lt;/em&gt; interface is defined. &lt;p&gt;At run time, when the end user types "sale" in an Excel range and clicks the smart tag action, then the smart tag calls into the &lt;em&gt;DisplayData&lt;/em&gt; method implemented in the VSTO add-in. This all happens by way of COM interop via several built-in APIs in VSTO and Office. &lt;p&gt;-------------------------------------------------- &lt;p&gt;McLean Schofield, programming writer&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8466997" 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/McLean+Schofield/default.aspx">McLean Schofield</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></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>Deploying an Office solution using Windows Installer (Mary Lee)</title><link>http://blogs.msdn.com/vsto/archive/2008/04/10/deploying-an-office-solution-using-windows-installer-mary-lee.aspx</link><pubDate>Fri, 11 Apr 2008 03:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8373360</guid><dc:creator>VSTO Team</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8373360.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8373360</wfw:commentRss><description>&lt;P&gt;Visual Studio 2008 offers a ClickOnce deployment experience for solutions developed for the 2007 Microsoft Office system.&amp;nbsp; However, if you want to deploy additional files, add extra registry keys, or use SMS, you may still be interested in creating a Windows Installer package. &lt;/P&gt;
&lt;P&gt;Here are the very basic steps to configure your setup project:&lt;/P&gt;
&lt;P&gt;1. Add the release build or publish output of your solution. Then manually add the application and deployment manifests (.dll.manifest and .vsto files).&lt;/P&gt;
&lt;P&gt;2. For application-level projects, create the registry keys so that the Microsoft Office application can find your add-in. For more information, see &lt;A href="http://go.microsoft.com/fwlink/?LinkID=107101"&gt;Registry Entries for Application-Level Add-Ins&lt;/A&gt;. For the add-in name, use a syntax similar to [CompanyName].[AddinName].&lt;/P&gt;
&lt;P&gt;3. For document-level projects, update custom document properties which point to the location of the deployment manifest. If you leave the document in the same relative location compared to the customization assembly, you don't need to update the _AssemblyLocation property. But if you want to move the document to a user's desktop or Documents folders, you'll have to update the _AssemblyLocation property. For more information, see &lt;A href="http://go.microsoft.com/fwlink/?LinkID=107108"&gt;Custom Document Properties Overview&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;You must still use ClickOnce security to trust your solution. You can deploy your .msi at this point, but you'll see a trust prompt asking whether the solution should be installed or not. To avoid prompting your end users, sign your manifests with a known and trusted certificate or pre-trust the solution by creating an inclusion list entry. For more information, see &lt;A class="" href="http://go.microsoft.com/fwlink/?LinkID=111232" mce_href="http://go.microsoft.com/fwlink/?LinkID=111232"&gt;Security in Office Solutions (2007 System)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Bonus: there is sample code to help you complete the steps of deploying additional files, updating the document's _AssemblyLocation, and creating an inclusion list entry.&amp;nbsp; Visit &lt;A href="http://code.msdn.microsoft.com/VSTO3MSI" mce_href="http://code.msdn.microsoft.com/VSTO3MSI"&gt;http://code.msdn.microsoft.com/VSTO3MSI&lt;/A&gt; in the MSDN Code Gallery to download the sample code.&lt;/P&gt;
&lt;P&gt;For all the details, read the deployment whitepapers at &lt;A class="" href="http://msdn.microsoft.com/en-us/library/cc563937.aspx" mce_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;&amp;nbsp;and &lt;A class="" href="http://msdn.microsoft.com/en-us/library/cc616991.aspx" mce_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;BR&gt;&lt;/A&gt;&lt;BR&gt;If you run into trouble implementing this, visit the VSTO MSDN forum at &lt;A href="http://forums.microsoft.com/msdn/showforum.aspx?forumid=16&amp;amp;siteid=1"&gt;http://forums.microsoft.com/msdn/showforum.aspx?forumid=16&amp;amp;siteid=1&lt;/A&gt;&amp;nbsp;to search for answers or ask your questions.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;Mary Lee, programming writer.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8373360" 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/Deployment/default.aspx">Deployment</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/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/MSI/default.aspx">MSI</category></item></channel></rss>