Value 方法

       

String 类型返回一个指定标记的值。

expression.Value(Index)

expression  必选。该表达式返回一个 Tags 集合。

Index  必选。Long 类型。标记编号。

示例

本示例显示与当前演示文稿的第一张幻灯片关联的每个标记的名称和值。

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

本示例搜索当前演示文稿中每张幻灯片的标记,如果存在名为“PRIORITY”的标记,将出现消息框显示该标记的值;如果不存在,则添加该标记,并设定标记值为“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