#1
|
|||
|
|||
In anonymized document, how to locate specific comments via XML
I have a large document with 100s of anonymized comments. The document was sent out for review with the anonymizing feature left turned on, so the many, many comments added by the reviewer are also anonymous. We need to separate them out.
How would you approach this task? Can it be done programmatically? I went into comments.xml and found that there's no date/time associated with each comment, so finding them by date wouldn't work. I also found that the comment numbers aren't chronologically sequential, AND that they change as a document evolves. In commentsids.xml, I found a bunch of unique identifiers, but not all identifiers had corresponding comments in the comments.xml file. I also tried changing the "Author" name of the old comments, via the old doc's comments.xml, then running a compare, but the revised name was reverted back to "Author" in the process. I ended up dropping the comments.xml text from both the original and the new documents into two Word files, did a compare, and then was able to see where the new comments were. (It would have been easier to simply open both and identify them visually.) But I have to assume that there IS a way to do this more easily. But how? We face this situation periodically, and it'd be nice to have a tool or process that streamlines untangling the aftermath of leaving the anonymizing feature on when a document goes out for review, and does so more quickly than manually. Thanks. |
#2
|
||||
|
||||
You can identity anonymous comments and what they relate to using a macro like:
Code:
Sub Demo() Dim Cmnt As Comment For Each Cmnt In ActiveDocument.Comments With Cmnt If .Author = "" Then .Scope.Select MsgBox .Range.Text End If End With Next End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks for your reply. Sorry I wasn't clear about the issue earlier. Let me try again:
We created a document that has about 200 comments in it. Using the anonymizing feature, all of the comments are attributed to "Author." Next, we sent the document outside our organization for review. But, unfortunately, the feature that anonymizes revisions/comments was left ON, so when the reviewer added their comments (they added about 100), they appear as having been created by "Author." So we have a document with 300 comments, all attributed to "Author," but 100 of them should be attributed to the actual reviewer's name, and I'd like to programmatically differentiate between them so I can change the name from Author to the reviewer's actual name. (Probably the easiest way is to view both documents side by side, to see where new ones were added. This is, of course, a manual process.) I wasn't able to do a compare in Word of the old and new version such that the reviewer's comments would be revealed. In the old version, if I went into comments.xml and changed "Author" to, say, "Author Internal," upon comparing, the new version would revert these old comments back to "Author." |
#4
|
||||
|
||||
You should be able to edit the Author names for the original using code like:
Code:
Sub DemoA() Dim Cmnt As Comment For Each Cmnt In ActiveDocument.Comments Cmnt.Author = "Internal" Next End Sub Code:
Sub DemoB() Application.ScreenUpdating = False Dim DocSrc As Document, DocTgt As Document Dim i As Long, j As Long Set DocSrc = ActiveDocument With Dialogs(wdDialogFileOpen) If .Display Then Set DocTgt = Documents.Open(FileName:=.Name, _ AddToRecentFiles:=False, Visible:=True) End If End With If DocTgt Is Nothing Then Exit Sub With DocTgt For j = i To .Comments.Count .Comments(j).Author = "External" Next End With With DocSrc For i = 1 To .Comments.Count With DocTgt For j = i To .Comments.Count With .Comments(j) If .Scope.Text = DocSrc.Comments(i).Scope.Text Then If .Range.Text = DocSrc.Comments(i).Range.Text Then .Author = "Internal" Exit For End If End If End With Next End With Next End With 'cleanup Set DocTgt = Nothing: Set DocSrc = Nothing Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thanks, Paul. The comment name-change macro works fine in Word 2016.
For the second macro, I was getting runtime error 5941 here: Code:
.Comments(j).Author = "External" Thank you very much for your help! Code:
Sub DemoB() 'Code from macropod: 'https://www.msofficeforums.com/word/40106-anonymized-document-how-locate- 'specific-comments-via.html#post132323 Application.ScreenUpdating = False Dim DocSrc As Document, DocTgt As Document Dim i As Long, j As Long Set DocSrc = ActiveDocument With Dialogs(wdDialogFileOpen) If .Display Then Set DocTgt = Documents.Open(FileName:=.Name, _ AddToRecentFiles:=False, Visible:=True) End If End With If DocTgt Is Nothing Then Exit Sub With DocTgt For Each Cmnt In ActiveDocument.Comments Cmnt.Author = "External" Next End With With DocSrc For i = 1 To .Comments.Count With DocTgt For j = i To .Comments.Count With .Comments(j) If .Scope.Text = DocSrc.Comments(i).Scope.Text Then If .Range.Text = DocSrc.Comments(i).Range.Text Then .Author = "Internal" Exit For End If End If End With Next End With Next End With 'cleanup Set DocTgt = Nothing: Set DocSrc = Nothing Application.ScreenUpdating = True End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Comments collapsed in document | hander | Word | 2 | 10-09-2015 05:33 AM |
Change name of document owner when writing comments | Mark Laslett | Word | 2 | 08-25-2015 01:03 PM |
Recreating a document with comments? | mrlemmer11 | Word VBA | 3 | 06-29-2015 05:04 AM |
Cannot Locate Archived Messages | abraxis | Outlook | 0 | 06-10-2014 03:32 PM |
Can't see comments on front page of Word document | Josaster | Word | 0 | 10-15-2012 06:37 AM |