Microsoft Office Tutorials and References
In Depth Information
Creating Excel smart tags with VSTO
By default, smart tag functionality is turned off in Microsoft Office Excel 2007. VSTO
smart tags can be used only in document-level projects for Excel 2007.
First, you need to turn on the smart tag recognition functionality. To do this, execute
the following procedure.
Open Visual Studio 2008 and create a new solution, as usual. The following is the
example code for adding smart tags using VSTO in the Excel solution. Add this code
to the Sheet1.cs file:
private void Sheet1_Startup(object sender, System.EventArgs e)
// Adding the NamedRange for cells
Microsoft.Office.Tools.Excel.NamedRange AuthorRange1 =
this.Controls.AddNamedRange(this.Range["B2", missing],
// Enabling SmartTag option in the workbook
Globals.ThisWorkbook.SmartTagOptions.EmbedSmartTags = true;
// Enabling SmartTag recognizer
Recognize = true;
// Applying formula, MSFT is the Stock Quote for Microsoft
// The SmartTag for recognizing stock symbols
AuthorRange1.Formula = "MSFT";
// SmartTags added to the action
Excel.SmartTag AuthorSmartTag1 = AuthorRange1.SmartTags.
Excel.SmartTag AuthorSmartTag2 = AuthorRange1.SmartTags.
Search JabSto ::

Custom Search