Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Comment Object
Collapse the table of content
Expand the table of content

Comment Object

Office 2007
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.

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



Community Additions

ADD
Show:
© 2015 Microsoft