<?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 : smart tags</title><link>http://blogs.msdn.com/vsto/archive/tags/smart+tags/default.aspx</link><description>Tags: smart tags</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><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>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>Understanding VSTO Smart Tags and COM Smart Tags (McLean Schofield)</title><link>http://blogs.msdn.com/vsto/archive/2008/05/02/understanding-vsto-smart-tags-and-com-smart-tags-mclean-schofield.aspx</link><pubDate>Fri, 02 May 2008 22:09:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8451621</guid><dc:creator>VSTO Team</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/vsto/comments/8451621.aspx</comments><wfw:commentRss>http://blogs.msdn.com/vsto/commentrss.aspx?PostID=8451621</wfw:commentRss><description>&lt;p&gt;The document-level projects for Excel and Word in VSTO (in Visual Studio 2005 and Visual Studio 2008) provide a simple object model that you can use to create smart tags for documents and workbooks. A smart tag is a string that an Office application recognizes in a document. After the application recognizes the string, it displays a small icon next to the text. The user can then click that icon to display a list of actions they can choose from and activate. Typically, the actions are related to in some way to the identified text. For example, you could have a smart tag that recognizes stock symbols; when a user types an uppercase string of letters that matches a known stock symbol, a list of stock-related actions, such as looking up a stock price, could appear.&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/CallingIntoAVSTOAddinFromaCOMSmartTag_8FE7/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="241" alt="image" src="http://blogs.msdn.com/blogfiles/vsto/WindowsLiveWriter/CallingIntoAVSTOAddinFromaCOMSmartTag_8FE7/image_thumb.png" width="369" border="0"&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;In most ways, creating smart tags using VSTO is much easier than creating smart tags without VSTO. However, there are some limitations that might prevent you from using VSTO to create smart tags. Even if you cannot use VSTO to create a smart tag, you can still use features in a VSTO add-in from the smart tag. &lt;/p&gt; &lt;p&gt;In this discussion, I'll refer to smart tags created by using VSTO as "VSTO smart tags", and smart tags created without using VSTO as "COM smart tags".&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Creating VSTO Smart Tags&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Creating a VSTO smart tag is relatively straightforward: you create a &lt;em&gt;SmartTag&lt;/em&gt; object that recognizes one or more terms, create one or more &lt;em&gt;Action&lt;/em&gt; objects that define the code that runs when the user clicks your smart tag options, and finally add the &lt;em&gt;SmartTag&lt;/em&gt; object to the &lt;em&gt;VstoSmartTags&lt;/em&gt; property of the &lt;em&gt;ThisDocument&lt;/em&gt; or &lt;em&gt;ThisWorkbook&lt;/em&gt; class in your project.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The following somewhat contrived example demonstrates a simple smart tag in an Excel workbook project. This smart tag recognizes the term "sale", and when clicked, the action displays the address of the cell that contains the recognized term in a message box. This code assumes it is running from the &lt;em&gt;ThisWorkbook&lt;/em&gt; class in the project.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Private SmartTagExample As Microsoft.Office.Tools.Excel.SmartTag&lt;br&gt;Private WithEvents DisplayAddressAction As Microsoft.Office.Tools.Excel.Action &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Private Sub AddSmartTag()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SmartTagExample = New Microsoft.Office.Tools.Excel.SmartTag( _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "www.microsoft.com/Demo#DemoSmartTag", "Smart Tag Example")&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SmartTagExample.Terms.Add("sale")&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DisplayAddressAction = New Microsoft.Office.Tools.Excel.Action( _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Display Cell Address") &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Add the action to the smart tag.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SmartTagExample.Actions = New Microsoft.Office.Tools.Excel.Action() { _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DisplayAddressAction} &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Add the smart tag to the workbook.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.VstoSmartTags.Add(SmartTagExample)&lt;br&gt;End Sub &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;Private Sub DisplayAddress_Click(ByVal sender As Object, _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ByVal e As Microsoft.Office.Tools.Excel.ActionEventArgs) _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Handles DisplayAddressAction.Click &lt;/font&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim smartTagAddress As String = e.Range.Address( _&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ReferenceStyle:=Excel.XlReferenceStyle.xlA1)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox("The recognized text '" &amp;amp; e.Text &amp;amp; _&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; "' is at range " &amp;amp; smartTagAddress)&lt;br&gt;End Sub&lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;For more information, see &lt;a href="http://msdn.microsoft.com/en-us/library/ms178787.aspx"&gt;How to: Add Smart Tags to Word Documents&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/ms178788.aspx"&gt;How to: Add Smart Tags to Excel Workbooks&lt;/a&gt; in the VSTO documentation.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Limitations of VSTO Smart Tags&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Although VSTO smart tags are easy to implement, they do have several limitations:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;VSTO smart tags can be used only in document-level projects for Excel and Word. They cannot be used in application-level add-ins for Excel and Word; therefore, you cannot create VSTO smart tags that are recognized in any document or workbook that the user might open (these are also called application-level smart tags).&lt;/li&gt; &lt;li&gt;VSTO smart tags also cannot be used in projects for any other Office application that supports smart tags, such as PowerPoint and Outlook (when composing e-mails with Word as the e-mail editor).&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If you need to create a smart tag for an application other than Word or Excel, or you need to create an application-level smart tag for Word or Excel, you must create a COM smart tag. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Creating COM Smart Tags&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;To create a COM smart tag, use the &lt;a href="http://msdn.microsoft.com/en-us/library/aa169576(office.11).aspx"&gt;Smart Tag SDK&lt;/a&gt; to create a managed (or unmanaged, if you prefer) DLL that implements 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; COM interfaces at a minimum, and optionally other interfaces, depending on the features you want to provide. This requires familiarity with COM programming, and that you implement all of the properties and methods of these interfaces, even those you don't intend to use. The DLL must also be registered on end user computers, as described in the Smart Tag SDK. &lt;/p&gt; &lt;h4&gt;&lt;strong&gt;&lt;font size="4"&gt;Implementing a COM Smart Tag in a VSTO Add-In&lt;/font&gt;&lt;/strong&gt;&lt;/h4&gt; &lt;p&gt;At this point, you might be wondering whether you could implement a COM smart tag in a VSTO add-in, since a VSTO add-in is a managed assembly, and you can implement COM interfaces in managed code. &lt;/p&gt; &lt;p&gt;You &lt;em&gt;could&lt;/em&gt;, but you probably don't want to. The reason for this is that add-ins and smart tag DLLs have entirely different discovery and load mechanisms in Office: &lt;/p&gt; &lt;ul&gt; &lt;li&gt;Office applications discover smart tag DLLs under the &lt;strong&gt;HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag&lt;/strong&gt; registry key, and then call into the smart tag DLL using only the smart tag-specific interfaces (&lt;a href="http://msdn.microsoft.com/en-us/library/aa207016(office.11).aspx"&gt;ISmartTagRecognizer&lt;/a&gt;, etc.). &lt;/li&gt; &lt;li&gt;On the other hand, Office applications discover add-in DLLs under &lt;a href="http://msdn.microsoft.com/en-us/library/bb386106.aspx"&gt;an entirely different (and application-specific) registry key&lt;/a&gt;, and then call into the add-in DLL using only the &lt;a href="http://msdn.microsoft.com/en-us/library/extensibility.idtextensibility2.aspx"&gt;IDTExtensibility2&lt;/a&gt; interface. &lt;/li&gt; &lt;ul&gt; &lt;li&gt;&lt;em&gt;Side-bar #1&lt;/em&gt;: If you're a VSTO developer who is thinking "IDTExtensibility-what???", VSTO abstracts the &lt;a href="http://msdn.microsoft.com/en-us/library/extensibility.idtextensibility2.aspx"&gt;IDTExtensibility2&lt;/a&gt; interface implementation away from your add-in code. The VSTO runtime implements this interface for you, and forwards the most interesting calls into this interface on to the &lt;em&gt;ThisAddIn_Startup&lt;/em&gt; and &lt;em&gt;ThisAddIn_Shutdown&lt;/em&gt; event handlers in your add-in code.&lt;/li&gt;&lt;/ul&gt; &lt;ul&gt; &lt;li&gt;&lt;em&gt;Side-bar #2&lt;/em&gt;: If you clicked on the &lt;a href="http://msdn.microsoft.com/en-us/library/extensibility.idtextensibility2.aspx"&gt;IDTExtensibility2&lt;/a&gt; link and are wondering why you wound up in the Visual Studio extensibility documentation, this is because this interface (and the Extensibility.dll assembly that defines it) is also used to build Visual Studio add-ins.&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt; &lt;p&gt;The implication of these differences is that if you implement the smart tag COM interfaces in a VSTO add-in assembly, your assembly will be loaded twice: once as an add-in, and again as a smart tag DLL. Depending on the size of your add-in, this could result in a lot of redundant code being loaded into memory. Furthermore, because every VSTO add-in is loaded into a separate application domain, the two instances of your assembly will be in separate application domains, and cannot easily share code or data. Because of these issues, there is not much of a benefit to implement a COM smart tag in a VSTO add-in.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;font size="4"&gt;Calling Into A VSTO Add-in From a COM Smart Tag—Is It Possible?&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;If you're following me this far, your next question might be "OK, so if I implement a COM smart tag DLL and a VSTO add-in as part of my overall Office solution, how can I call into my add-in from my smart tag?" Because there are many Office customization features that can be used only in an add-in, you can probably think of many scenarios where this might be useful. For example, you might implement a &lt;a href="http://msdn.microsoft.com/en-us/library/aa942864.aspx"&gt;custom task pane&lt;/a&gt; in an add-in for Excel, and you want to display unique information on this task pane when the user clicks a smart tag action in any open workbook. When the user clicks your action, how can your smart tag tell your add-in to display data in the custom task pane?&lt;/p&gt; &lt;p&gt;There are a number of ways you can do this. 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 this is to &lt;a href="http://msdn.microsoft.com/en-us/library/bb608621.aspx"&gt;expose an object in your add-in to other Office solutions&lt;/a&gt;, and then to call into this object from your smart tag. My next post will show how to do this. &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=8451621" 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></item></channel></rss>