Compartilhar via


SmartTagType Object

Word Developer Reference

Represents a type of smart tag. A smart tag type is a single item in a smart tag list. Smart tag lists can contain multiple smart tag types. For example, the Address smart tag list installed on English systems by default contains a name smart tag type, a street smart tag type, and a city smart tag type, to name just a few.

Remarks

Use the Item method to return a specific smart tag type in a collection of smart tag types. Then use the SmartTagRecognizers property to return all smart tag recognizers associated with a specified type of smart tag, and use the SmartTagActions property to return all smart tag actions associated with a specified type of smart tag. The following example reloads the smart tag recognizers and action handlers for the Address smart tag type.

Bb178928.vs_note(en-us,office.12).gif  Note
The Index parameter of the Item method can be either an Integer, representing the index position of the smart tag type, or a String, representing the Uniform Resource Name (URN) for the smart tag type. The URN is case sensitive; therefore, "Address" is different from "address" in the following example.
Visual Basic for Applications
  Sub ReloadAddressActionsRecognizersUsingItemMethod()
    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

The following example does the same as the previous, except that it uses the FriendlyName property to access the necessary SmartTagType object.

Visual Basic for Applications
  Sub ReloadAddressActionsRecognizersUsingFriendlyName()
    Dim objSmartTagType As SmartTagType
    Dim strSmartTagType As String
    
    For Each objSmartTagType In Application.SmartTagTypes
        If objSmartTagType.FriendlyName = "Address" Then
        With objSmartTagType
            .SmartTagActions.ReloadActions
            .SmartTagRecognizers.ReloadRecognizers
        End With
        
        Exit For
    End If
Next

End Sub

Bb178928.vs_note(en-us,office.12).gif  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 then 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.

See Also