When we are using Spelling check function of Word, sometime we may need to use a different dictionary than the default one. The default dictionary is determined by default language. In Word.Application object, there is a property called Language, but it is read only and can not be changed.
After some search on Google, I finally find that Word.Range object has a property called LanguageID, which you can set to change the dictionary used in spelling check.
Following code snippet shows how to use different dictionary:
After some search on Google, I finally find that Word.Range object has a property called LanguageID, which you can set to change the dictionary used in spelling check.
Following code snippet shows how to use different dictionary:
Private Function CheckRangeSpelling(ByRef oRange As Word.Range) As Boolean
' Grab the text before spell checking
Dim strText As String = oRange.Text
' Check the spelling using French Canadian dictionary
oRange.NoProofing = False
oRange.LanguageID = Word.WdLanguageID.wdFrenchCanadian
oRange.CheckSpelling()
' Check if user has changed anything during the spell checking
If strText <> oRange.Text Then
Return True
Else
Return False
End If
End Function
Comments