When exporting Word review comments, how do you reference the sentence related to a comment?

后端 未结 2 652
梦谈多话
梦谈多话 2021-02-10 15:29

I am trying to export a Word document\'s review comments. I want to export the sentence selection that was commented on followed by the comment.

Screen shot of the imag

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-10 16:03

    I found someone on another site to solve this question.

    The key to the solution is: cmt.Scope.FormattedText

    Here is the function revised:

    Sub ExportComments()
        Dim s As String
        Dim cmt As Word.Comment
        Dim doc As Word.Document
    
        For Each cmt In ActiveDocument.Comments
            s = s & "Text: " & cmt.Scope.FormattedText & " -> "
            s = s & "Comments: " & cmt.Initial & cmt.Index & ":" & cmt.Range.Text & vbCr
        Next
    
        Set doc = Documents.Add
        doc.Range.Text = s
    End Sub
    

提交回复
热议问题