Class Comment (PowerPoint VBA)

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

The main procedure of class Comment is Delete

Set

To use a Comment class variable it first needs to be instantiated, for example

Dim cmm as Comment
Set cmm = Application.Selection.Comments(Index:=1)

The following procedures can be used to set variables of type Comment: Comments.Item, Comments.Add2, Replies, Slide.Comments and SlideRange.Comments

Methods

This is the main method of the Comment class

Delete - Deletes the specified Comment object.

cmm.Delete

Other Methods

Comments.Add2 - Replaces hidden Add method. Returns a Comment object that represents a new comment added to a slide. For more infomation about modern comments, see Modern comments in PowerPoint.

Dim strAuthor As String: strAuthor = 
Dim strAuthorInitials As String: strAuthorInitials = 
Dim strText As String: strText = 
Dim strProviderID As String: strProviderID = 
Dim strUserID As String: strUserID = 
Dim cmms As Comments: Set cmms = 
Dim cmmAdd2 As Comment
Set cmmAdd2 = cmms.Add2(Left:=, Top:=, Author:=strAuthor, AuthorInitials:=strAuthorInitials, Text:=strText, ProviderID:=strProviderID, UserID:=strUserID)

Properties

Author returns a String that represents the author as for a specified Comment object.

Dim strAuthor As String
strAuthor = cmm.Author

AuthorIndex returns a Long representing the index number of a comment for a given author. The first comment for a given author has an index number of 1, their second comment has an index number of 2.

Dim lngAuthorIndex As Long
lngAuthorIndex = cmm.AuthorIndex

AuthorInitials returns the author's initials as a read-only String for a specified Comment object.

Dim strAuthorInitials As String
strAuthorInitials = cmm.AuthorInitials

Collapsed returns whether the replies to a comment are shown (expanded) or hidden (collapsed). Ready-only.

Dim booCollapsed As Boolean
booCollapsed = cmm.Collapsed

DateTime returns the date and time a comment was created.

Dim dtDateTime As Date
dtDateTime = cmm.DateTime

Left returns a Single that represents the distance in points from the left edge of the comment to the left edge of the slide.

Dim sngLeft As Single
sngLeft = cmm.Left

Parent returns the parent object for the specified object.

Dim objParent As Object
Set objParent = cmm.Parent

ProviderID returns a String that represents ID of the service providing contact information.

Dim strProviderID As String
strProviderID = cmm.ProviderID

Replies returns a Comments collection of Comment objects that are children of the specified comment.

Dim cmmsReplies As Comments
Set cmmsReplies = cmm.Replies

Text returns a String that represents the text in a comment.

Dim strText As String
strText = cmm.Text

TimeZoneBias returns a String that specifies the local time zone adjustment for the contact.

Dim lngTimeZoneBias As Long
lngTimeZoneBias = cmm.TimeZoneBias

Top returns a Single that represents the distance in points from the left edge of the comment to the left edge of the slide.

Dim sngTop As Single
sngTop = cmm.Top

UserID returns a String that represents user ID of the contact.

Dim strUserID As String
strUserID = cmm.UserID

Comments.Count returns the number of objects in the specified collection.

Dim cmms As Comments: Set cmms = 
Dim lngCount As Long
lngCount = cmms.Count

Comments.Parent returns the parent object for the specified object.

Dim cmms As Comments: Set cmms = 
Dim objParent As Object
Set objParent = cmms.Parent