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

最佳答案

这是一个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

关于vba - Microsoft Word宏来计算注释,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11986842/

10-13 05:44