![]() |
|
|
|
#1
|
|||
|
|||
|
I am trying to extract comments from a Word document into an Excel spreadsheet.
The goal is to extract a parent and child comment and place them in the same record and continue to iterate through the document. For some reason the coding will populate a Child comment as a new record when only a parent comment should, and I'm looking to have that not happen. Current code attached. Any help is much appreciated! Last edited by amschaefer; 10-19-2023 at 01:24 PM. Reason: Attaching code |
|
#2
|
||||
|
||||
|
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 |
|
| Tags |
| comment |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| XML Schema Parent Child Extraction | ChrisOK | Excel Programming | 0 | 11-16-2017 08:22 AM |
Updating "Parent Phrase" to change all Child Phrases - (References, Fields, Headings?)
|
tclass117 | Word | 1 | 11-18-2016 10:14 PM |
| Hilight Parent Folder when Child folder is allocated a new email | brucemc777 | Outlook | 2 | 11-09-2016 09:14 AM |
Advanced Content Control Problem, Making CC editable through child links not only parent
|
Lance Dwight | Word | 1 | 10-15-2014 05:45 PM |
How to insert a (balloon) comment and how to disable comment feature in Word2007?
|
pstein | Word | 2 | 03-31-2012 05:31 AM |