2

我是一名教学设计师;我通过添加评论来编辑word文档。我在问是否可以找到一个 Word 宏来帮助我计算这些评论并对其进行分类。感谢你的帮助

4

1 回答 1

4

这是Sub根据您的类别计算项目:

Sub CountComments()
    Dim spelling, grammar, rephrasing, technical, other As Integer
    spelling = 0
    grammar = 0
    rephrasing = 0
    technical = 0
    other = 0

    Dim comment As comment
    For Each comment In ActiveDocument.Comments

        Dim firstWord As String
        firstWord = Split(comment.Range.Text, " ")(0)

        Select Case LCase(firstWord)
            Case "spelling"
                spelling = spelling + 1
            Case "grammar"
                grammar = grammar + 1
            Case "rephrasing"
                rephrasing = rephrasing + 1
            Case "technical"
                technical = technical + 1
            Case Else
                other = other + 1
        End Select
    Next

    MsgBox _
        "Spelling:" & spelling & _
        "; Grammar:" & grammar & _
        "; Rephrasing:" & rephrasing & _
        "; Technical:" & technical & _
        "; Other:" & other, , "Comment category summary"
End Sub
于 2012-08-17T05:32:16.520 回答