views:

265

answers:

1

Let's say I have a requirements document in MS Word, and someone else reviews it an provides a list of issues found using the "Track Changes" feature.

Is there a way to extract "how many major/minor issues were found during the review?" using an automated script - for metrics purposes?

I see CodeCollaborator has some MS Word integration, but it doesn't seem to know how to look inside Word to extract the tracked changes data. It just launches the document.

+2  A: 

I did once write a Word macro that extracts the comments to a separate document, you are welcome to try adapting this to your purposes, if you have trouble then reply here and I can give you a hand with making changes.

Public Sub PROCESS_COMMENTS()

Dim strReplaceText As String
Dim myPar As Paragraph
Dim strCurrentColumn As String
Dim i As Integer
Dim Com As Comment

    Application.ScreenUpdating = False

    '   set the input and output docs.
    Set inDoc = ActiveDocument
    '   check we have comments to process in the original document
    If inDoc.Comments.Count < 1 Then
        MsgBox "No comments in the document"
        Exit Sub
    End If

    '   comments exist so create new document
    Set outDoc = Documents.Add
    Set outRange = outDoc.Content

    outDoc.Range.InsertAfter "List of Comments:"
    outDoc.Paragraphs(outDoc.Paragraphs.Count).Style = outDoc.Styles("Heading 1")
    outDoc.Range.InsertParagraphAfter


    '   cycle through comments, inserting them in the new document
    '   display the new document and refresh
    outDoc.Activate
    Application.ScreenRefresh

    For Each Com In inDoc.Comments
        outRange.InsertAfter "[" & Com.Author & " - " & Com.Initial & Com.Index & "] "
        outDoc.Paragraphs(outDoc.Paragraphs.Count).Range.Font.Bold = True
        outDoc.Range.InsertParagraphAfter
        outRange.InsertAfter Com.Range.Text
        outDoc.Paragraphs(outDoc.Paragraphs.Count).Range.Font.Bold = False

        Set myRange = Com.Scope


        outDoc.Range.InsertParagraphAfter
        outDoc.Range.InsertParagraphAfter
    Next

    Application.ScreenUpdating = True
    Set outDoc = ActiveDocument

End Sub
James Piggot