object that represents the shapes with the specified tag.
expression.FindShapesByTag(TagName)
expression Required. An expression that returns a Document object.
TagName Required String. The name of the tag.
Example
This example adds two shapes to the first page of the active publication, assigns each a tag, and then enters the name of each tag into the text frame of its assigned shape.
Sub FindShape()
Dim strTag1 As String
Dim strTag2 As String
With ActiveDocument.Pages(1).Shapes
With .AddShape(Type:=msoShape5pointStar, Left:=50, _
Top:=50, Width:=75, Height:=75)
strTag1 = .Tags.Add(Name:="Star", _
Value:="This is a star.").Name
End With
With .AddShape(Type:=msoShapeHeart, Left:=100, _
Top:=100, Width:=75, Height:=75)
strTag2 = .Tags.Add(Name:="Heart", _
Value:="This is a heart.").Name
End With
End With
With ActiveDocument
.FindShapesByTag(TagName:=strTag1).TextFrame _
.TextRange.Text = strTag1
.FindShapesByTag(TagName:=strTag2).TextFrame _
.TextRange.Text = strTag2
End With
End Sub