Using Tags
Tags are like sticky notes that you can tack onto a presentation, a slide or any shape on a slide.
There's no user interface, so for all intents and purposes, they're invisible to users.
To programmers, they're hugely useful for identifying specific shapes or storing information about shapes, slides or presentations within the shapes, slides, presentations themselves.
Here are a few simple examples that demonstrate how you can display and set tags:
Sub ShowTags() ' Show me the tag name and value for each tag on each shape ' that has a tag on the currently displayed slide Dim x As Long Dim oSh As Shape For Each oSh In ActiveWindow.View.Slide.Shapes If oSh.Tags.Count > 0 Then With oSh.Tags For x = 1 To .Count MsgBox oShName & vbtab & .Name(x) & vbTab & .Value(x) Next ' x End With End If Next ' oSh End Sub
Sub AddTag() ' Adds the tag "TAGNAME" with value "TAGVALUE" ' to the currently selected shape With ActiveWindow.Selection.ShapeRange(1) .Tags.Add "TagName", "TagValue" End With End Sub
Sub ShowTagValue() ' Displays the current value of tag "TagName" on the selected shape With ActiveWindow.Selection.ShapeRange(1) MsgBox .Tags("TagName") End With End Sub