0
votes

Using a VBA macro in MS Word, how can i count the word that have errors in a paragraph?

Hi.

I've a very long and bilingual (italian and ancient greek) text to transcode; it is a .doc document converted from a .pdf with custom and closed font encodings.
This converted document is composed mostly of italian paragraphs and gibberish (because the font has a custom encoding).

The transcoding process will be a Find & Replace (eg. find "/A", replace with alpha), but i don't want the macro to replace the italian letters.

I've come to the conclusion that a way of getting only the gibberish/greek replaced is to count the spelling errors of each paragraph and converting the paragraph only if the errors are > 5-10% of the word count. (it is my first serious vba macro, if anyone has any suggestion about other methods, he is welcome. Also, I hope that my English is acceptable and readable).

1

1 Answers

0
votes
Function ErrorPercent(para As Paragraph) As Double

    With para.Range
        ErrorPercent = (.GrammaticalErrors.Count + .SpellingErrors.Count) / .Words.Count
    End With

End Function