(PowerPoint) 注释对象

表示在指定的幻灯片或幻灯片范围的注释。 该 注释 对象是 注释 集合对象的成员。

备注

使用以下属性访问批注数据:

属性 说明
Author 作者的全名
AuthorIndex 作者在批注列表中的索引
AuthorInitials 作者姓和名的首字母
DateTime 创建批注的日期和时间
Text 批注的文本
左侧顶部 批注的屏幕坐标

示例

使用 注释 (索引) ,其中 index 是批注的编号,或者使用 Item 方法访问幻灯片上的单个批注。 本示例显示第一张幻灯片的第一个批注的作者。 如果没有评论,则会显示一条消息指出此类。

Sub ShowComment()

    With ActivePresentation.Slides(1).Comments

        If .Count > 0 Then

            MsgBox "The first comment on this slide is by " & .Item(1).Author

        Else

            MsgBox "There are no comments on this slide."

        End If

    End With

End Sub

本示例显示一条消息,其中包含第一张幻灯片上所有批注的作者、日期和时间以及内容。

Sub SlideComments()

    Dim cmtExisting As Comment
    Dim cmtAll As Comments
    Dim strComments As String

    Set cmtAll = ActivePresentation.Slides(1).Comments

    If cmtAll.Count > 0 Then
        For Each cmtExisting In cmtAll
            strComments = strComments & cmtExisting.Author & vbTab & _
                cmtExisting.DateTime & vbTab & cmtExisting.Text & vbLf
        Next
        MsgBox "The comments in your document are as follows:" & vbLf & strComments
    Else
        MsgBox "This slide doesn't have any comments."
    End If

End Sub

另请参阅

PowerPoint 对象模型引用

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。