![]() |
#1
|
|||
|
|||
![]()
So I have this code from Allen Wyatt that used to be working just fine, but now it puts even parts of words in red, even though I have set .matchwholeword to true.
So if I have the word "or" on my confusables list, it will put the "or" in the word "color" in red, but I only want the actual word "or" to be in red. Code:
Sub CompareWordList() Dim sCheckDoc As String Dim docRef As Document Dim docCurrent As Document Dim wrdRef As Object sCheckDoc = "the path to my confusables.doc" Set docCurrent = Selection.Document Set docRef = Documents.Open(sCheckDoc) docCurrent.Activate With Selection.Find .ClearFormatting .Replacement.ClearFormatting .Replacement.Font.Color = wdColorRed .Replacement.Text = "^&" .Forward = True .Format = True .MatchWholeWord = True .MatchCase = False .MatchWildcards = False End With For Each wrdRef In docRef.Words If Asc(Left(wrdRef, 1)) > 32 Then With Selection.Find .Wrap = wdFindContinue .Text = wrdRef .Execute Replace:=wdReplaceAll End With End If Next wrdRef docRef.Close docCurrent.Activate End Sub Any ideas? I am an editor, and I use this to change words to red that are often confused with other words or often need punctuation with them to help me catch additional errors, but it is distracting to have it put parts of words in red. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
True/False Error | DonBerg68 | Excel | 2 | 08-30-2019 08:51 PM |
![]() |
jriker1 | Mail Merge | 5 | 10-14-2017 01:11 PM |
![]() |
ayupchap | Mail Merge | 1 | 04-25-2017 02:45 PM |
True 4:3 background dimensions | a_gunslinger | PowerPoint | 1 | 11-28-2016 08:22 PM |
![]() |
oluc | Word VBA | 4 | 11-21-2010 08:10 AM |