View Single Post
 
Old 10-19-2023, 11:41 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,978
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I'm not seeing a better way to work out the parent/child relationship so I've done this kludgy method. You could adopt the same principle in your code.
If the comment doesn't have an ancestor then it must be a top level comment
Then use the Replies.Count to iterate through the replies

Code:
Sub aTest()
  Dim aCmt As Comment, sAuth As String, sReplies As String
  Dim i As Integer, aReply As Comment
  For Each aCmt In ActiveDocument.Comments
    If aCmt.Ancestor Is Nothing Then        'a top level comment
      Debug.Print aCmt.Author, aCmt.Done, aCmt.Range.Text, aCmt.Replies.Count
      If aCmt.Replies.Count > 0 Then
        For i = 1 To aCmt.Replies.Count
          Set aReply = aCmt.Replies(i)
          sReplies = sReplies & vbTab & aReply.Author & ": " & aReply.Range.Text & vbCr
        Next i
        Debug.Print sReplies
        sReplies = ""
      End If
    End If
  Next aCmt
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote