Andrew Melim

Hello, I am running VS 2005 with VSTO and Office 2003. I am trying to create a Word document smart tag, however when I try to call

Code Snippet
this.VstoSmartTags.add(mySmartTag);

I get an error saying there is no definition for VstoSmartTags. Here is my full code

Code Snippet

using System;

using System.Windows.Forms;

using Microsoft.VisualStudio.Tools.Applications.Runtime;

using Word = Microsoft.Office.Interop.Word;

using Office = Microsoft.Office.Core;

using Microsoft.Office.Tools.Word;

namespace WordAddIn3

{

public partial class ThisAddIn

{

private void ThisAddIn_Startup(object sender, System.EventArgs e)

{

SmartTag mySmartTag = new SmartTag("http://www.digg.com#digg", "Digg it");

mySmartTag.Terms.Add("digg");

Action myAction = new Action("&Digg this story!");

myAction.Click += new ActionClickEventHandler(myAction_Click);

this.VstoSmartTags.add(mySmartTag);//error occurs here

}

void myAction_Click(object sender, ActionEventArgs e)

{

MessageBox.Show(String.Format("You dugg this story!", e.Range.Start));

}

private void ThisAddIn_Shutdown(object sender, System.EventArgs e)

{

}

private void InternalStartup()

{

this.Startup +=new EventHandler(ThisAddIn_Startup);

}

}

}



Re: Visual Studio Tools for Office Adding SmartTags

Phil Hoff - MSFT

Was the error that the VstoSmartTags property did not exist, or that the "add" method on the VstoSmartTags property type did not exist (I suspect it was the latter.) Have you tried the following (notice the change from 'a' to 'A'):

Code Snippet

this.VstoSmartTags.Add(mySmartTag);

-Phil




Re: Visual Studio Tools for Office Adding SmartTags

Andrew Melim

It states that there is no definition for the VstoSmartTags property.




Re: Visual Studio Tools for Office Adding SmartTags

Andrew Melim

Sorry to bump, but I really need an answer. Thanks.



Re: Visual Studio Tools for Office Adding SmartTags

Phil Hoff - MSFT

Sorry, I saw you say that you were creating a "Word document smart tag" but missed that what you were actually creating in the code was a Word add-in. The VstoSmartTags property is only available with Office document-level customizations, not Office application add-ins. Instead you will need to create a Smart Tag DLL, which is basically a couple of objects that implement a set of Smart Tag COM interfaces.

Here is a starting point: http://msdn2.microsoft.com/en-us/library/aa296266(office.11).aspx

-Phil