CustomProperty 对象

         
CustomProperties
CustomProperty

该对象代表智能标记的自定义属性的单独实例。CustomProperty 对象是 CustomProperties 集合的一个成员。

使用 CustomProperty 对象

使用 CustomProperties 集合的 Item 方法或 Properties(Index) 可返回一个 CustomProperty 对象,其中 index 为该属性的编号。使用 NameValue 属性可返回与智能标记的自定义属性相关的信息。本示例显示一条消息,其中包含当前文档中第一个智能标记的第一个自定义属性的名称和属性值。本示例假定当前文档至少包含一个智能标记,并且第一个智能标记至少具有一个自定义属性。

Sub SmartTagsProps()
    With ThisDocument.SmartTags(Index:=1).Properties.Item(Index:=1)
        MsgBox "Smart Tag Name: " & .Name & vbLf & _
            "Smart Tag Value: " & .Value
    End With
End Sub