Share via


Tags.Name Method

Returns the name of the specified tag as a String.

Namespace:  Microsoft.Office.Interop.PowerPoint
Assembly:  Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)

Syntax

'Declaration
Function Name ( _
    Index As Integer _
) As String
'Usage
Dim instance As Tags
Dim Index As Integer
Dim returnValue As String

returnValue = instance.Name(Index)
string Name(
    int Index
)

Parameters

Return Value

Type: System.String
String

Examples

This example displays the name and value for each tag associated with slide one in the active presentation.

With Application.ActivePresentation.Slides(1).Tags

    For i = 1 To .Count

        MsgBox "Tag #" & i & ": Name = " & .Name(i)

        MsgBox "Tag #" & i & ": Value = " & .Value(i)

    Next

End With

This example searches through the tags for each slide in the active presentation. If there is a tag named "PRIORITY," a message box displays the tag value. If there is no tag named "PRIORITY," the example adds this tag, giving it the value "Unknown."

For Each s In Application.ActivePresentation.Slides

    With s.Tags

        found = False

        For i = 1 To .Count

            If .Name(i) = "PRIORITY" Then

                found = True

                slNum = .Parent.SlideIndex

                MsgBox "Slide " & slNum & _

                    " priority: " & .Value(i)

            End If

        Next

        If Not found Then

            slNum = .Parent.SlideIndex

            .Add "Name", "New Figures"

            .Add "Priority", "Unknown"

            MsgBox "Slide " & slNum & _

                " priority tag added: Unknown"

        End If

    End With

Next

See Also

Reference

Tags Interface

Tags Members

Microsoft.Office.Interop.PowerPoint Namespace