Chapter 22. Smart Tags

In this chapter, I discuss the programmatic control of smart tags. Note that to create custom smart tags, we need to use an application that can create automation servers (COM DLLs), such as Visual Basic or Visual C++. Custom smart tags cannot be created in Excel XP, although existing smart tags can be controlled programmatically.

Since smart tags are new to Office XP, let us begin with a brief description of their purpose. To illustrate the concept of a smart tag, imagine that you type a date, such as January 1, 2002, in Word XP (with smart tags turned on). The smart tag system recognizes the text "January 1, 2002" as a date and underlines it with a dotted line. If you then place the mouse over the date, a small button that looks like an "i" with a circle around it (a smart tag action button) appears. Clicking on this button drops down a list of actions, as shown in Figure 22-1.

From this menu, as the name suggests, we can choose an action to perform, such as scheduling a meeting on this date. Indeed, if we click on this action, Microsoft Outlook's appointment dialog will open, wherein we can set up the meeting.

Figure 22-2 illustrates the use of smart tags in Excel XP. Here we have entered a stock ticker symbol into a worksheet cell, whereupon leaving the cell Excel XP will recognize the symbol as a smart tag type. (Excel XP comes with some built-in smart tag recognizers, as can be seen from the smart tag tab of the AutoCorrect Options dialog box.)

Thus, smart tags are tools that recognize certain types of data within an Office document and present the user with a list of predefined actions. (At the user-interface level, the smart tag options dialog can be reached through the AutoCorrect Options menu item under the Tools menu.)