Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2018, 11:10 AM
Peterson Peterson is offline In anonymized document, how to locate specific comments via XML Windows 7 64bit In anonymized document, how to locate specific comments via XML Office 2016
Competent Performer
In anonymized document, how to locate specific comments via XML
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 08-17-2018, 07:25 PM
macropod's Avatar
macropod macropod is offline In anonymized document, how to locate specific comments via XML Windows 7 64bit In anonymized document, how to locate specific comments via XML Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
It's not clear what you mean by 'We need to separate them out', though.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 08-19-2018, 04:42 PM
Peterson Peterson is offline In anonymized document, how to locate specific comments via XML Windows 7 64bit In anonymized document, how to locate specific comments via XML Office 2016
Competent Performer
In anonymized document, how to locate specific comments via XML
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default

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."
Reply With Quote
  #4  
Old 08-19-2018, 05:17 PM
macropod's Avatar
macropod macropod is offline In anonymized document, how to locate specific comments via XML Windows 7 64bit In anonymized document, how to locate specific comments via XML Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
I'm not sure if this still works in Office 2016, though. If it does, you might also try running the following macro from the original document.
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
Do note that, if the external reviewers have edited the actual text a comment applies to, or have edited a comment, the above code won't recognise your 'Internal' comments as being such.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 08-20-2018, 10:26 AM
Peterson Peterson is offline In anonymized document, how to locate specific comments via XML Windows 10 In anonymized document, how to locate specific comments via XML Office 2016
Competent Performer
In anonymized document, how to locate specific comments via XML
 
Join Date: Jan 2017
Posts: 141
Peterson is on a distinguished road
Default

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"
...so I modified a few lines (pasted below for posterity) and everything works great!

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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
In anonymized document, how to locate specific comments via XML 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
In anonymized document, how to locate specific comments via XML 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

Other Forums: Access Forums

All times are GMT -7. The time now is 08:08 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft