Consulting

Results 1 to 5 of 5

Thread: Replies to comments in Word

  1. #1
    VBAX Newbie
    Joined
    Feb 2017
    Posts
    2
    Location

    Replies to comments in Word

    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

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,335
    Location
    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
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    VBAX Newbie
    Joined
    Feb 2017
    Posts
    2
    Location
    Quote Originally Posted by gmaxey View Post
    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

  4. #4

    macro to get the list of ms word comments and it’s replies in different column

    Quote Originally Posted by edrake View Post
    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

  5. #5
    Hello team, please help to get the macro to capture the list of MS word original comments and their replies in different column.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •