View Single Post
 
Old 08-20-2018, 10:26 AM
Peterson Peterson is offline Windows 10 Office 2016
Competent Performer
 
Join Date: Jan 2017
Posts: 143
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