Represents installed components that label text with types of information. For example, the Address (English) smart tag component contains recognizers for street, city, state, and postal code, among other address-related items. When a user activates an installed component either through code or by using the Smart Tags tab in the Auto Correct dialog box, Microsoft Office Word labels the text that matches these items in a document.
Remarks
Use the Item method of the SmartTagRecognizers collection to return a single SmartTagRecognizer object. Once a SmartTagRecognizer object is returned, you can determine whether smart tag recognizers are enabled for the application. The following example reloads the smart tag recognizers and action handlers for the Address smart tag type.
Visual Basic for Applications
Sub GetSmartTagType()
Dim objSmartTagType As SmartTagType
Dim strSmartTagType As String
strSmartTagType = "urn:schemas-microsoft-com" & _
":office:smarttags#address"
Set objSmartTagType = Application.SmartTagTypes _
.Item(strSmartTagType)
With objSmartTagType
.SmartTagActions.ReloadActions
.SmartTagRecognizers.ReloadRecognizers
End With
End Sub
Note
The following example uses the Microsoft Visual Basic InStr keyword to locate the desired smart tag. In this case, the Caption property returns the string "Address (English)" to denote that it is the English version of the Address smart tag recognizer. Therefore, this code enables all Address smart tag recognizers regardless of language or location.
Visual Basic for Applications
Sub EnableAddressSmartTags()
Dim objRecognizer As SmartTagRecognizer
' Determine if smart tag recognizers are enabled.
For Each objRecognizer In Application.SmartTagRecognizers
If InStr(1, objRecognizer.Caption, "Address") > 0 Then
If objRecognizer.Enabled = False Then objRecognizer.Enabled = True
End If
Next
End Sub
Note
SmartTagRecognizer, SmartTagAction, and SmartTagType objects are related in that each item that a smart tag component recognizes is a SmartTagType object. For example, "city" in the Address smart tag component is a specific SmartTagType object. The city smart tag type has related SmartTagRecognizer objects (the part of the smart tag component that recognizes smart tags of type "city" in documents) and SmartTagAction objects (the part of the smart tag component that provides the actions related to the specific smart tag type, which may include looking up a recognized city in Microsoft MapPoint on MSN). The recognizer does the labeling, the action handler provides end-user functionality, and what ties them together is the type of smart tag they work on.