WORD 2013里测试是没有问题。问题可能是在其它版本里。
宏的写法做了点修改:
Private Sub CommandButton1_Click()
Dim i As Integer
Set allComments = ActiveDocument.Comments
If allComments.Count = 0 Then
MsgBox "本文档没有批注。"
Else
Selection.GoTo What:=wdGoToBookmark, Name:="批注插入点"
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdStory, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.TypeParagraph
Selection.TypeParagraph
For i = 1 To ActiveDocument.Comments.Count
msg = i & "、" & ActiveDocument.Comments(i).Author & "于 " & Act
iveDocument.Comments(i).Date & " 作了批注:"
Selection.TypeText (msg)
Selection.TypeParagraph
ActiveDocument.Comments(i).Range.Copy
Selection.Paste
Selection.TypeParagraph
Selection.TypeParagraph
Next
Selection.GoTo What:=wdGoToBookmark, Name:="批注插入点"
Selection.MoveRight Unit:=wdCharacter, Count:=1
End If
End Sub
【 在 unchained (琉璃光) 的大作中提到: 】
: word和wps运行,都提示:运行时错误 9 下标越界?
: msg = i & "、" & Split(cmnt.Contact.Name, """")(3) & "于 " & cmnt.Date & " 作了批注:"
--
FROM 58.23.247.*
附件(27.3KB) 提取批注.docm