View Single Post
 
Old 03-31-2015, 10:29 PM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

It depends on how the document is formatted. A correctly formatted document would have the appropriate language proofing parameter applied to the texts. Then it would be fairly straightforward to search for the required language by searching for text with the proofing language applied. If however the document doesn't have the proofing languages applied, the words not in the default language could be flagged as incorrectly spelled, but languages have a way of sharing words, so you would have to determine by eye whether a correctly spelled word belonged to one language or the other.

If the document is correctly formatted with respect to language, the following macro should get you started.

Code:
Sub HighlightLanguage()
Dim oRng As Range
    Set oRng = ActiveDocument.Range
    oRng.HighlightColorIndex = wdYellow
    With oRng.Find
        .LanguageID = wdEnglishUS 'Or wdEnglishUK
        Do While .Execute
            'Do something with the found text e.g
            oRng.HighlightColorIndex = wdNoHighlight
        Loop
    End With
lbl_Exit:
    Exit Sub
End Sub
The macro highlights all the text, then searches for text that is English (you need to specify which flavour of English is not US English) and removes the highlight from that text.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote