![]() |
|
|
|
#1
|
||||
|
||||
|
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] |
|
#2
|
|||
|
|||
|
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 |