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 に答える