Table of contents
TOC
Collapse the table of content
Expand the table of content

Comment Object (PowerPoint)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Represents a comment on a given slide or slide range. The Comment object is a member of the Comments collection object.

Remarks

Use the following properties to access comment data:

AuthorThe author's full name
AuthorIndexThe author's index in the list of comments
AuthorInitialsThe author's initials
DateTimeThe date and time the comment was created
TextThe text of the comment
Left, TopThe comment's screen coordinates

Example

Use Comments (index), where index is the number of the comment, or the Item method to access a single comment on a slide. This example displays the author of the first comment on the first slide. If there are no comments, it displays a message stating such.

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

This example displays a message containing the author, date and time, and contents of all the messages on the first slide.

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

See also

Concepts

PowerPoint Object Model Reference

© 2017 Microsoft