Tags object (Publisher)
A collection of Tag objects that represent tags or custom properties applied to a shape, shape range, page, or publication.
Remarks
Use the Shape.Tags property to access the Tags collection.
Use the Add method to add a Tag object to a shape, shape range, page, or publication.
Use the Count property to determine if a shape, shape range, page, or publication contains one or more Tag objects.
Example
This example adds a tag to each oval shape on the first page of the active publication.
Sub AddNewTag()
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:="Shape", Value:="Oval"
End If
Next shp
End With
End Sub
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(1).Value = "Oval" Then
shp.Fill.ForeColor.RGB = RGB(Red:=255, Green:=0, Blue:=0)
End If
End If
Next shp
End With
End Sub
Methods
Properties
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.