PDA

View Full Version : Replies to comments in Word



edrake
02-10-2017, 12:57 AM
Hi

I just registered, with the hope of finding an answer to this. Unfortunately, searching for "reply" and "comment" is not very practical, since it gives endless amounts of hits (both here and on the internet in general)...so I try asking explicitly. Sorry if there is an answer alread,y that I should have found.

in a documents.comments collection there is a list of item1, item2 etc, seemingly representing the individual comment objects. Each comment has a "replies" property, which is a collection of comments. However, it seems to be pointing back to the full comments collection (I.e. each individual commment has a pointer to the full set of comments in its "replies" property). This goes on in level after level, until I have no energy to look further. I think it is indeed just a looping reference. I.e. see the same object over and over..

As a result, I cannot figure out the actual hierarchy of comments and replies, that I see in the Word document when browsing it It all appears as a flat list, to me?

Am I missing something here? I must be...

Regards E

gmaxey
02-10-2017, 07:09 AM
Not exactly sure what your are trying to do. Yes, all comments and all replies are part of one big comments collection. However, .Replies returns a collection of comments (replies) to a parent comment. So maybe this will help:


Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oComments As Comments
Dim oComment As Comment
Dim lngIndex As Long
Set oComments = ActiveDocument.Comments
For Each oComment In oComments
If oComment.Replies.Count > 0 Then
For lngIndex = 1 To oComment.Replies.Count
MsgBox oComment.Replies(lngIndex).Range.Text
Next
End If
Next
lbl_Exit:
Exit Sub
End Sub

edrake
02-10-2017, 08:58 AM
Not exactly sure what your are trying to do. Yes, all comments and all replies are part of one big comments collection.

I am extracting all comments and creating a list of them. And want to indicate which ones are replies to others.
They all show up in the right order so basically just indenting the ones which are replies is what I want.

I inspect the datastructure, and the replies to each and every comment actually leads me to the full list of comments, in an endless recursion. Which does not help me at all.

However I note now that there is an ancestor to every comment, and that one is 'nothing' for those on the top level but actually point at the one a reply is a reply to. So that works, even though it is a little more backwards...

Do you sctually know that replies has the expected values, or do you just read the documentation which states UT should have them? What I see in the environment us not matching the documentation, as I interpret it.
Regards E

shantanumit
08-03-2021, 11:03 AM
Hi

I just registered, with the hope of finding an answer to this. Unfortunately, searching for "reply" and "comment" is not very practical, since it gives endless amounts of hits (both here and on the internet in general)...so I try asking explicitly. Sorry if there is an answer alread,y that I should have found.

in a documents.comments collection there is a list of item1, item2 etc, seemingly representing the individual comment objects. Each comment has a "replies" property, which is a collection of comments. However, it seems to be pointing back to the full comments collection (I.e. each individual commment has a pointer to the full set of comments in its "replies" property). This goes on in level after level, until I have no energy to look further. I think it is indeed just a looping reference. I.e. see the same object over and over..

As a result, I cannot figure out the actual hierarchy of comments and replies, that I see in the Word document when browsing it It all appears as a flat list, to me?

Am I missing something here? I must be...

Regards E

shantanumit
08-03-2021, 11:05 AM
Hello team, please help to get the macro to capture the list of MS word original comments and their replies in different column.