SmartTags Collection

Microsoft Word Visual Basic

SmartTags Collection

         
Multiple objects SmartTags
SmartTag

A collection of SmartTag objects that represents the text in a document that is marked as containing recognized type information. The SmartTags collection contains all the smart tags in a document or range of text within a document. Microsoft Word uses a recognizer file to label smart tags, and it uses an action file to execute actions related to the smart tags, such as linking to Web sites.

Using the SmartTags collection

Use the Item method — or SmartTags(index), where index represents the number of the smart tag — to return a single SmartTag object. This example adds custom properties to the first smart tag in the active document.

Sub NewSmartTagProp()
    ActiveDocument.SmartTags(1).Properties _
        .Add Name:="President", Value:=True
End Sub