我需要从注释中更改作者姓名,并使用VB应用程序进行格式化。
我尝试使用此代码重命名注释,但是对于格式化文本来说,它并没有改变。
Dim objComment As Comment
'Change all author names in comments
For Each objComment In ActiveDocument.Comments
objComment.Author = "Editor"
objComment.Initial = "ED"
Next objComment
请检查屏幕截图
答案 0 :(得分:0)
那是因为屏幕截图中的元素不是注释。这是一个审核更改-至少在格式化时启用了修订跟踪。如果您不希望跟踪文档的更改,则应关闭修订跟踪,并接受文档中的所有修订。
答案 1 :(得分:0)
Sub ChangeCommentAuthor()
Dim J As Integer
Dim rNameFind As String
Dim rNameRePlace As String
rNameFind = InputBox("Enter the Reviwer Name to Find", vbOK)
rNameRePlace = InputBox("Enter the Reviwer name to Replace", vbOK)
If (rNameFind = "") Then
MsgBox "Input Reviwer Name to find is empty"
Exit Sub
End If
If (rNameRePlace = "") Then
MsgBox "Input Reviwer Name to replace is empty"
Exit Sub
End If
For J = 1 To 3
For i = 1 To ActiveDocument.Comments.Count
Dim oInitial As String
If InStr(1, ActiveDocument.Comments(i).Initial, "") > 0 Then
oInitial = Replace(ActiveDocument.Comments(i).Initial, rNameFind, rNameRePlace)
Set objComment = ActiveDocument.Comments(i)
objComment.Initial = oInitial
End If
Next i
Next J
结束子