I just got a chance to check out the code and what you can do is go
into the VBA code inside the template and look for this section of
code:
'================================================= ==
Sub ColorWords(ByVal strText As String, _
ByVal MyColor As Variant)
With ActiveDocument.Content.Find
.ClearFormatting
With .Replacement
.ClearFormatting
.Font.Color = MyColor
End With
.Execute FindText:=strText, ReplaceWith:=strText, _
Format:=True, Replace:=wdReplaceAll
End With
End Sub
'================================================= ==
You can add the
.MatchWholeWord = True
....argument as Suzanne suggests and that'll give you a refine search.
I didn't look at the article well enough before to rememeber that Greg
eventually does call a find/replace routine. So change the above
section of code so it looks like this:
'================================================= ==
Sub ColorWords(ByVal strText As String, _
ByVal MyColor As Variant)
With ActiveDocument.Content.Find
.ClearFormatting
With .Replacement
.ClearFormatting
.MatchWholeWord = True '--- this is the new line
.Font.Color = MyColor
End With
.Execute FindText:=strText, ReplaceWith:=strText, _
Format:=True, Replace:=wdReplaceAll
End With
End Sub
'================================================= ==
Have fun!
Dian D. Chapman, Technical Consultant
Microsoft MVP, MOS Certified
Editor/TechTrax Ezine
Free Tutorials:
http://www.mousetrax.com/techtrax
Free Word eBook:
www.mousetrax.com/books.html
Optimize your business docs:
www.mousetrax.com/consulting
Learn VBA the easy way:
www.mousetrax.com/techcourses.html
On Fri, 28 Jan 2005 15:13:02 -0800, ?B?QW5vcm9u?=
wrote:
That is so helpful that I am planning to mention it to the rest of my writers
guild! I do have one question though. Is there a way to make it flag only
entire words (for example it is coloring the word "very" -- even in the word
everything)? Thanks.