Partager via


Comments Object (PowerPoint)

Represents a collection of Comment objects.

Example

Use the Comments property to refer to the Comments collection. The following example displays the number of comments on the current slide.

Sub CountComments()

    MsgBox "You have " & ActiveWindow.Selection.SlideRange(1) _

        .Comments.Count & " comments on this slide."

End Sub

Use the Add method to add a comment to a slide. This example adds a new comment to the first slide of the active presentation.

Sub AddComment()

    Dim sldNew As Slide

    Dim cmtNew As Comment



    Set sldNew = ActivePresentation.Slides.Add(Index:=1, _

        Layout:=ppLayoutBlank)

    Set cmtNew = sldNew.Comments.Add(Left:=12, Top:=12, _

        Author:="Jeff Smith", AuthorInitials:="JS", _

        Text:="You might consider reviewing the new specs" & _

        "for more up-to-date information.")

End Sub

See Also

Concepts

Comments Object Members

PowerPoint Object Model Reference