Class CommentThreaded (Excel VBA)

The class CommentThreaded represents a cell's threaded comment. This object can represent both a top-level comment or its replies.

The main procedures of class CommentThreaded are AddReply and Delete


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

Dim ctd As CommentThreaded: Set ctd = 
Dim ctdAddReply As CommentThreaded
Set ctdAddReply = ctd.AddReply(Text:="")

The following procedures can be used to set variables of type CommentThreaded: Replies, Worksheet.CommentsThreaded, CommentsThreaded.Item, Next, Previous, AddReply, Range.AddCommentThreaded and Range.CommentThreaded

For Each

Here is an example of processing the CommentThreaded items in a collection.

Dim ctd As CommentThreaded: Set ctd = 
Dim ctdReplie As CommentThreaded
For Each ctdReplie In ctd.Replies
Next ctdReplie


These are the main methods of the CommentThreaded class

AddReply - If the comment is a top-level comment, it will add a reply to its replies collection.

Worksheets(1).Range("E5").CommentThreaded.AddReply "Current Sales"

Delete - Deletes the specified threaded comment and all replies associated with that comment (if any exist).


Other Methods

Text - Sets threaded comment text.


CommentsThreaded.Count returns a Long value that represents the number of objects in the collection.

CommentsThreaded.Parent returns the parent object for the specified object. Read-only.

Author returns the Author object that represents the author of the specified CommentThreaded object.

For Each c in ActiveSheet.CommentsThreaded
 If c.Author.Name = "Jean Selva" Then c.Delete 

Date returns a date String-Variant that represents the date and time that a threaded comment was added in local time. Read-only.

Parent returns the parent object for the specified object. Read-only.

Replies if this comment is a parent, returns a CommentsThreaded collection of CommentThreaded objects that are children/replies of the specified comment (if any exist). The replies are sorted by time stamp.