SmartTagType Object

Microsoft Word Visual Basic

SmartTagType Object

SmartTagTypes SmartTagType
Multiple objects

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.

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). Put simply, 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.

Using the SmartTagType Object

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.

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.

    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.

    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