Share via


SmartTag.Properties Property

Word Developer Reference

Returns a CustomProperties collection that represents the properties of a smart tag.

Syntax

expression.Properties

expression   An expression that returns a SmartTag object.

Remarks

You can use the Add method to add custom properties from within a Microsoft Word Visual Basic for Applications project. However, custom properties are generally specified in the smart tag recognizer and action files.

Example

This example loops through all the smart tags in the current document, and then it creates a new document and lists the names and values of custom properties for all smart tags that have custom properties.

Visual Basic for Applications
  Sub SmartTagProps()
    Dim docNew As Document
    Dim stgTag As SmartTag
    Dim stgProp As CustomProperty
    Dim intTag As Integer
    Dim intProp As Integer
'Create new document and add heading content
Set docNew = Documents.Add

With docNew.Content
    .InsertAfter "Name" & vbTab & "Value"
    .InsertParagraphAfter
End With

'Loop through smart tags in current document
For intTag = 1 To ActiveDocument.SmartTags.Count

    With ActiveDocument.SmartTags(intTag)

        'Verify that a smart tag has properties
        If .<strong class="bterm">Properties</strong>.Count &gt; 0 Then

            'Enter the name and value of properties into new document
            For intProp = 1 To .<strong class="bterm">Properties</strong>.Count
                docNew.Content.InsertAfter .<strong class="bterm">Properties</strong>(intProp) _
                    .Name &amp; vbTab &amp; .<strong class="bterm">Properties</strong>(intProp).Value
                docNew.Content.InsertParagraphAfter
            Next
        Else

            'Display message if no properties for smart tag
            MsgBox "There are no custom properties for this smart tag."
        End If
    End With
Next

'Convert the tabbed list in the new document to a table
docNew.Content.Select
Selection.ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=2

End Sub

See Also