Share via


Tag Object [Publisher 2003 VBA Language Reference]

Tags
Tag

Represents a tag or a custom property that you can create for a shape, shape range, page, or publication. Each Tag object contains the name of a custom property and a value for that property. Tag objects are members of the Tags collection.

Create a tag when you want to be able to selectively work with specific members of a collection, based on an attribute that isn't already represented by a built-in property.

Using the Tag object

Use the Item method of the Tags collection to return a Tag object. This example fills all shapes on the first page of the active publication if the shape's first tag has a value of Oval.

Sub FormatTaggedShapes()
    Dim shp As Shape
    With ActiveDocument.Pages(1)
        For Each shp In .Shapes
            If shp.Tags.Count > 0 Then
                If shp.Tags.Item(1).Value = "Oval" Then
                    shp.Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
                End If
            End If
        Next
    End With
End Sub

Use the Add method to add a Tag object. This example adds a tag to all oval shapes in the active publication.

Sub TagShapes()
    Dim shp As Shape
    With ActiveDocument.Pages(1)
        For Each shp In .Shapes
            If InStr(1, shp.Name, "Oval") > 0 Then
                shp.Tags.Add Name:="Oval", Value:="This is an oval shape."
            End If
        Next shp
    End With
End Sub

Properties | Application Property | Name Property | Parent Property | Value Property

Methods | Delete Method

Parent Objects

Child Objects