Wednesday, June 11, 2008

Reading Tags in Powerpoint

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


Source:

No comments: