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. To use a CommentThreaded class variable it first needs to be instantiated, for example
Dim ctd as CommentThreaded
Set ctd = Dim strText As String: strText =
ActiveCell.AddCommentThreaded(Text:=strText)
For Each
Here is an example of processing the CommentThreaded items in a collection.
Dim ctdReplie As CommentThreaded
For Each ctdReplie In Application.Replies
Next ctdReplie
AddReply
If the comment is a top-level comment, it will add a reply to its replies collection.
AddReply (Text)
Text: The reply's text.
Dim ctdAddReply As CommentThreaded
Set ctdAddReply = ActiveCell.AddCommentThreaded.AddReply()
Author
Returns the Author object that represents the author of the specified CommentThreaded object.
Dim athAuthor As Author
Set athAuthor = ActiveCell.AddCommentThreaded.Author
Date
Returns a date String-Variant that represents the date and time that a threaded comment was added in local time. Read-only.
Dim dtToday As Date
dtToday = ActiveCell.AddCommentThreaded.Date
Delete
Deletes the specified threaded comment and all replies associated with that comment (if any exist).
ActiveCell.AddCommentThreaded.Delete
Next
Returns a CommentThreaded object that represents the next threaded comment.
If called on a top-level (parent) CommentThreaded object, it returns a top-level (parent) CommentThreaded object that represents the next comment. Using this method on the last comment on a sheet returns Null (not the next comment on the next sheet). If called on a reply CommentThreaded object, it returns a reply CommentThreaded object that represents the next reply of a thread. This method works only on one thread. Using this method on the last reply of a thread returns Null (not the next top-level comment).
Dim ctdNext As CommentThreaded
Set ctdNext = ActiveCell.AddCommentThreaded.Next()
Previous
Returns a CommentThreaded object that represents the previous threaded comment.
If called on a top-level (parent) CommentThreaded object, it returns a top-level (parent) CommentThreaded object that represents the previous comment. Using this method on the first comment on a sheet returns Null (not the last comment on the previous sheet). If called on a reply CommentThreaded object, it returns a reply CommentThreaded object that represents the previous reply of a thread. This method works only on one thread. Using this method on the first reply of a thread returns Null (not its top-level comment).
Dim ctdPrevious As CommentThreaded
Set ctdPrevious = ActiveCell.AddCommentThreaded.Previous()
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.
Dim ctdReplies As CommentsThreaded
Set ctdReplies = ActiveCell.AddCommentThreaded.Replies
Resolved
ActiveCell.AddCommentThreaded.Resolved = True
Text
Sets threaded comment text.
Dim strText As String
strText = ActiveCell.AddCommentThreaded.Text()
Arguments
Optional arguments
The following arguments are optional
Text (String) - The text to be added.
Start (Long) - The character number where the added text will be placed. If the Overwrite parameter is True or blank, and if this argument is omitted, any existing text in the threaded comment is deleted.
Overwrite (Boolean) - False to insert the text. The default value is True (text is overwritten).