Table of contents
TOC
Collapse the table of content
Expand the table of content

Tags Object (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

A collection of Tag objects that represents tags or custom properties applied to a shape, shape range, page, or publication.

Example

Use the Tags property to access the Tags collection. Use the Add method of the Tags collection to add a Tag object to a shape, shape range, page, or publication. 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

Use the Count property to determine if a shape, shape range, page, or publication contains one or more Tag objects. 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

Name
Add
Item

Properties

Name
Application
Count
Parent
© 2018 Microsoft