Comment Object

PowerPoint Developer Reference

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:

Author The author's full name
AuthorIndex The author's index in the list of comments
AuthorInitials The author's initials
DateTime The date and time the comment was created
Text The text of the comment
Left , Top The 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.

Visual Basic for Applications
  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.

Visual Basic for Applications
  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