Writer&';s Friend


by Dale Stubbart

WrF_Common_Misspellings

Donate here

Sub Wrf_Common_Misspellings()
Dim CommonMisspellings As String: CommonMisspellings = "[break][brake][buy][by][its][it's][lets][let's][then][than][there][they're][their][though][through][to][too][two][whose][who's][wonder][wander][your][you're][the][you][want]"
CommonMisspellings = Replace(CommonMisspellings, "'", Chr(146))
Dim OKThan As String: OKThan = "[more][less][worse]"
If Selection.Type = wdSelectionIP Then
Selection.WholeStory
End If
PrevWord = ""
For Each wordi In Selection.Words
SingleWord = Trim(LCase(wordi))
If InStr(CommonMisspellings, "[" & SingleWord & "]") Then
If SingleWord = "than" Then
If InStr(OKThan, "[" & PrevWord & "]") Or Right$(PrevWord, 2) = "er" Then
Else
wordi.HighlightColorIndex = wdYellow
End If
Else
wordi.HighlightColorIndex = wdYellow
End If
End If
PrevWord = SingleWord
Next wordi
End Sub
Sub WrF_Clear_Highlighting()
If Selection.Type = wdSelectionIP Then
Selection.WholeStory
End If
Selection.Range.HighlightColorIndex = wdNoHighlight
End Sub