Is there a way to get it to recognize whole words and not instances like FBI
or CIA?
When I have searched for words and then marked them to be highlighted, when
I exit the FIND window, the highlighting disappears. I know I'm not doing
something right but I don't know what.
AFAIK there isn't a complete solution. You can certainly find and highlight
all instances ALL CAP words. With a macro, you can even exclude the
specific acronyms FBI and CIA, however excluding "like" acronyms is a
different matter:
Sub SratchMacro()
Dim oRng As Range
Set oRng = ActiveDocument.Content
With oRng.Find
.ClearFormatting
.Text = "<[A-Z]{2,}>"
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
Do While .Execute
With oRng
Select Case .Text
Case "FBI", "CIA" 'add as many acronyms as necessary.
'Do Nothing
Case Else
.HighlightColorIndex = wdYellow
End Select
End With
Loop
End With
End Sub
For help installing macros see:
http://www.gmayor.com/installing_macro.htm
Note the macro above only searches the current document story range (range
containing the cursor). If you need to search all story ranges (e.g.,
headers, footers, etc.) then it would require more code.
--
Greg Maxey
See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.
Arrogance is a weed that grows mostly on a dunghill (Arabic proverb)
Dim oRng As Range
Set oRng = ActiveDocument.Content
With oRng.Find
.ClearFormatting
.Text = ""
.Font.AllCaps = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
Do While .Execute
With oRng
Select Case .Text
Case "FBI", "CIA" 'add as many acronyms as necessary.
'Do Nothing
Case Else
.HighlightColorIndex = wdYellow
End Select
End With
Loop
End With
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
Roger that. Good point. Thanks.
Graham Mayor wrote:
> If the words are formatted with the All Caps font parameter then you
> would need a slightly different approach
>
> Dim oRng As Range
> Set oRng = ActiveDocument.Content
> With oRng.Find
> .ClearFormatting
> .Text = ""
> .Font.AllCaps = True
> .Forward = True
> .Wrap = wdFindStop
> .MatchWildcards = True
> Do While .Execute
> With oRng
> Select Case .Text
> Case "FBI", "CIA" 'add as many acronyms as necessary.
> 'Do Nothing
> Case Else
> .HighlightColorIndex = wdYellow
> End Select
> End With
> Loop
> End With
>
>
>
--
If using W2003: after setting up your search, put a check in the box before
"Highlight all items found in:" and then click find all. Without closing
the Find dialog, change the focus to the document and then click the
highlight icon (home tab > font group). All the selected items will be
highlighted.
Pam
--
Message posted via http://www.officekb.com
--
Best regards
Lene Fredborg
Microsoft MVP (Word)
DocTools - Denmark
http://www.thedoctools.com
"Pamelia Caswell via OfficeKB.com" <u43222@uwe> skrev i en meddelelse
news:9ec4df4996dee@uwe...
Hopefully, the problem with the delay will be fixed soon.
--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
I didn't think to go outside the window to highlight text before closing it.
With this solution I can create a more simple Macro for what I want.
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
"ISay" <IS...@discussions.microsoft.com> wrote in message
news:0992E161-9ADD-41FC...@microsoft.com...