Tabulating the errors.

D

Designingsally

Hi
I m looking for macros which can tabulate errors.
For example,
When a document is sent to me. I find errors and I segregate the errors into
4 categories namely,
nouns
subject-verb agreement
Tense
Flow
When I find an error regarding noun, sub verb agreement, tense, flow etc- I
make a note of it on the word using the track changes. After noting the
errors, meaning after i note that user has made errors in subject-verb
aggrement 5 times and etc. I want the macros to create a table for me with
nouns, subject-verb agreement, tense, flow etc as rows/ columns and make a
note how many times which type of error had been done.

Note: I DONT want macros to identify the errors in tense or subject-verb
agreement etc. I will identify it myself and mark it using track changes.

Is this possible to do??
Pls let me how.?
Can someone come up with a code or something which can help me resolve this
issue.


DesigningSally
 
P

Pesach Shelnitz

Hi,

If you mean that as you run track changes, you will add comments containing
the expressions "nouns", "subject-verb agreement", "tense", and "flow," the
following macro should create the table that you want. Note that the macro
will detect these expressions regardless of whether they are capitalized or
not and that it will count these expressions even if more than one of them is
included in the same comment.

Sub ErrorTabulator()

Dim comm As Comment
Dim myTable As table
Dim nounsCount As Long
Dim svCount As Long
Dim tenseCount As Long
Dim flowCount As Long

nounsCount = 0
svCount = 0
tenseCount = 0
flowCount = 0
For Each comm In ActiveDocument.Comments
If InStr(1, comm.Range.Text, "nouns", vbTextCompare) <> 0 Then
nounsCount = nounsCount + 1
End If
If InStr(1, comm.Range.Text, "subject-verb agreement", _
vbTextCompare) <> 0 Then
svCount = svCount + 1
End If
If InStr(1, comm.Range.Text, "tense", vbTextCompare) <> 0 Then
tenseCount = tenseCount + 1
End If
If InStr(1, comm.Range.Text, "flow", vbTextCompare) <> 0 Then
flowCount = flowCount + 1
End If
Next
Selection.EndKey wdStory
Set myTable = Selection.Tables.Add(Selection.Range, _
NumRows:=2, NumColumns:=4, _
DefaultTableBehavior:=wdWord9TableBehavior)
With myTable
.Cell(1, 1).Range.Text = "Nouns"
.Cell(1, 2).Range.Text = "Subject-verb agreement"
.Cell(1, 3).Range.Text = "Tense"
.Cell(1, 4).Range.Text = "Flow"
.Cell(2, 1).Range.Text = nounsCount
.Cell(2, 2).Range.Text = svCount
.Cell(2, 3).Range.Text = tenseCount
.Cell(2, 4).Range.Text = flowCount
End With
End Sub
 
D

Designingsally

Hi Pesach Shelnitz

Thanks for the reply.

But the macros that you have given me seem to not to work even if I type
nouns, subject-verb agreement etc in the comment box. I will be glad if u
look into it.



DesigingSally
 
P

Pesach Shelnitz

Hi,

It works for me in both Word 2007 and Word 2003. Is it creating a table at
the end of the document at all? Please try again.

Pesach
 
G

Greg Maxey

Hi,

If you mean that as you run track changes, you will add comments containing
the expressions  "nouns", "subject-verb agreement", "tense", and "flow," the
following macro should create the table that you want. Note that the macro
will detect these expressions regardless of whether they are capitalized or
not and that it will count these expressions even if more than one of them is
included in the same comment.

Sub ErrorTabulator()

    Dim comm As Comment
    Dim myTable As table
    Dim nounsCount As Long
    Dim svCount As Long
    Dim tenseCount As Long
    Dim flowCount As Long

    nounsCount = 0
    svCount = 0
    tenseCount = 0
    flowCount = 0
    For Each comm In ActiveDocument.Comments
        If InStr(1, comm.Range.Text, "nouns", vbTextCompare) <> 0Then
            nounsCount = nounsCount + 1
        End If
        If InStr(1, comm.Range.Text, "subject-verb agreement", _
            vbTextCompare) <> 0 Then
            svCount = svCount + 1
        End If
        If InStr(1, comm.Range.Text, "tense", vbTextCompare) <> 0Then
            tenseCount = tenseCount + 1
        End If
        If InStr(1, comm.Range.Text, "flow", vbTextCompare) <> 0 Then
            flowCount = flowCount + 1
        End If
    Next
    Selection.EndKey wdStory
    Set myTable = Selection.Tables.Add(Selection.Range, _
        NumRows:=2, NumColumns:=4, _
        DefaultTableBehavior:=wdWord9TableBehavior)
    With myTable
        .Cell(1, 1).Range.Text = "Nouns"
        .Cell(1, 2).Range.Text = "Subject-verb agreement"
        .Cell(1, 3).Range.Text = "Tense"
        .Cell(1, 4).Range.Text = "Flow"
        .Cell(2, 1).Range.Text = nounsCount
        .Cell(2, 2).Range.Text = svCount
        .Cell(2, 3).Range.Text = tenseCount
        .Cell(2, 4).Range.Text = flowCount
    End With
End Sub

--
Hope this helps,
Pesach Shelnitz








- Show quoted text -

Pesach,

Worked for me too, but I would probably do it more like this:

Sub ErrorTabulator()
Dim oComment As Comment
Dim oTbl As Table
Dim lngNoun As Long
Dim lngAgr As Long
Dim lngTense As Long
Dim lngFlow As Long
lngNoun = 0
lngAgr = 0
lngTense = 0
lngFlow = 0
For Each oComment In ActiveDocument.Comments
Select Case True
Case InStr(1, oComment.Initial, "Nouns", vbTextCompare) <> 0
lngNoun = lngNoun + 1
Case InStr(1, oComment.Initial, "Agr (S/V)", vbTextCompare) <> 0
lngAgr = lngAgr + 1
Case InStr(1, oComment.Initial, "Tense", vbTextCompare) <> 0
lngTense = lngTense + 1
Case InStr(1, oComment.Initial, "Flow", vbTextCompare) <> 0
lngFlow = lngFlow + 1
End Select
Next
With ActiveDocument
.Paragraphs.Last.SpaceAfter = 12
.Bookmarks("\endofdoc").Select
Set oTbl = .Tables.Add(Selection.Range, NumRows:=2, NumColumns:=4)
With oTbl
.Cell(1, 1).Range.Text = "Nouns"
.Cell(1, 2).Range.Text = "Subject-verb agreement"
.Cell(1, 3).Range.Text = "Tense"
.Cell(1, 4).Range.Text = "Flow"
.Cell(2, 1).Range.Text = lngNoun
.Cell(2, 2).Range.Text = lngAgr
.Cell(2, 3).Range.Text = lngTense
.Cell(2, 4).Range.Text = lngFlow
End With
End With
End Sub

I have a proofreading tool AddIn posted on my website:
http://gregmaxey.mvps.org/Proofreader_Marks_AddIn.htm

It works only in Word2007 as it started out more an exercise in ribbon
customization than in practical proofreading. Anyway, it temporarily
assigns a code to the Applicaiton.UserInitials value to represent
error categories. So if you mark an error as a spelling error the
comment will appear [sp.1]-This word is mispelled. Therefore in my
code I would use oCommen.Initial in the InStr test.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top