Share via


Properties Property

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

expression.Properties

expression Required. 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.

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 ThisDocument.SmartTags.Count

        With ThisDocument.SmartTags(intTag)

            'Verify that a smart tag has properties
            If .Properties.Count > 0 Then

                'Enter the name and value of properties into new document
                For intProp = 1 To .Properties.Count
                    docNew.Content.InsertAfter .Properties(intProp) _
                        .Name & vbTab & .Properties(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

Applies to | SmartTag Object