|
|
| Next: Power Point |
| Author |
Message |
ISay External

Since: Nov 07, 2009 Posts: 2
|
Posted: Sat Nov 07, 2009 5:02 am Post subject: Find and highlight all instances of ALL CAPS Archived from groups: microsoft>public>word>docmanagement (more info?) |
|
|
I know, thanks to y'all, that <[A-Z]{2,}> will find words written in ALL
CAPS. How can I find and highlight all instances?
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. |
|
| Back to top |
|
 |
Greg Maxey External

Since: Feb 01, 2009 Posts: 57
|
Posted: Sat Nov 07, 2009 8:22 am Post subject: Re: Find and highlight all instances of ALL CAPS [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
USay,
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.
ISay wrote:
> I know, thanks to y'all, that <[A-Z]{2,}> will find words written in
> ALL CAPS. How can I find and highlight all instances?
>
> 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.
--
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) |
|
| Back to top |
|
 |
Graham Mayor External

Since: Jul 04, 2006 Posts: 4677
|
Posted: Sat Nov 07, 2009 9:10 am Post subject: Re: Find and highlight all instances of ALL CAPS [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
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
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Greg Maxey wrote:
> USay,
>
> 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.
>
>
>
> ISay wrote:
>> I know, thanks to y'all, that <[A-Z]{2,}> will find words written in
>> ALL CAPS. How can I find and highlight all instances?
>>
>> 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. |
|
| Back to top |
|
 |
Greg Maxey External

Since: Feb 01, 2009 Posts: 57
|
Posted: Sat Nov 07, 2009 9:10 am Post subject: Re: Find and highlight all instances of ALL CAPS [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Graham,
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
>
>
>
> Greg Maxey wrote:
>> USay,
>>
>> 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. ISay wrote:
>>> I know, thanks to y'all, that <[A-Z]{2,}> will find words written in
>>> ALL CAPS. How can I find and highlight all instances?
>>>
>>> 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.
--
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) |
|
| Back to top |
|
 |
Pamelia Caswell via Offic External

Since: May 20, 2009 Posts: 18
|
Posted: Sat Nov 07, 2009 2:10 pm Post subject: Re: Find and highlight all instances of ALL CAPS [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
If using W2007: after setting up your search, click the find in button and
choose "Main Document". Word will select all instances. 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.
You can also use the reading highlight, but I prefer to select the items
because you can act on the selections (highlight, copy, paste, change font,
delete, etc.).
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
ISay wrote:
>I know, thanks to y'all, that <[A-Z]{2,}> will find words written in ALL
>CAPS. How can I find and highlight all instances?
>
>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.
--
Message posted via http://www.officekb.com |
|
| Back to top |
|
 |
Lene Fredborg External

Since: Nov 29, 2006 Posts: 562
|
Posted: Sat Nov 07, 2009 4:22 pm Post subject: RE: Find and highlight all instances of ALL CAPS [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Something has been wrong in the Microsoft Discussion Groups for some time.
There is a delay in showing replies posted from elsewhere (sometimes for days
and maybe some replies never appear). Currently, 5 replies have been given to
your question(s) but I can see that none of them appear in the Microsoft
Discussion Groups yet. The thread can be read here:
http://groups.google.com/group/microsoft.public.word.docmanagement/bro..._thread
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
"ISay" wrote:
> I know, thanks to y'all, that <[A-Z]{2,}> will find words written in ALL
> CAPS. How can I find and highlight all instances?
>
> 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.
> |
|
| Back to top |
|
 |
Lene Fredborg External

Since: Nov 08, 2009 Posts: 1
|
Posted: Sat Nov 07, 2009 7:10 pm Post subject: Re: Find and highlight all instances of ALL CAPS [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
You do not need to leave the Find and Replace dialog box in order to apply
the highlight. Insert whatever you want to search for in the "Find what"
field. Click in the "Replace with" field. Then select Highlight from the
Format menu (bottom of dialog box - click More if it is not visible) and
leave the Replace with field empty. When you click Replace All, the
currently selected highlight color will be applied to all instances found.
This also works with wildcard search.
--
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...
> If using W2007: after setting up your search, click the find in button and
> choose "Main Document". Word will select all instances. 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.
> You can also use the reading highlight, but I prefer to select the items
> because you can act on the selections (highlight, copy, paste, change
> font,
> delete, etc.).
>
> 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
>
> ISay wrote:
>>I know, thanks to y'all, that <[A-Z]{2,}> will find words written in ALL
>>CAPS. How can I find and highlight all instances?
>>
>>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.
>
> --
> Message posted via http://www.officekb.com
> |
|
| Back to top |
|
 |
ISay External

Since: Nov 07, 2009 Posts: 2
|
Posted: Sat Nov 07, 2009 10:31 pm Post subject: RE: Find and highlight all instances of ALL CAPS [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Thanks, following your link I was able to find the solution.
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.
"Lene Fredborg" wrote:
> Something has been wrong in the Microsoft Discussion Groups for some time.
> There is a delay in showing replies posted from elsewhere (sometimes for days
> and maybe some replies never appear). Currently, 5 replies have been given to
> your question(s) but I can see that none of them appear in the Microsoft
> Discussion Groups yet. The thread can be read here:
>
> http://groups.google.com/group/microsoft.public.word.docmanagement/bro..._thread
>
> 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
> |
|
| Back to top |
|
 |
Suzanne S. Barnhill External

Since: Sep 26, 2003 Posts: 24065
|
Posted: Sun Nov 08, 2009 7:00 am Post subject: Re: Find and highlight all instances of ALL CAPS [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
As Lene points out, however, it is not necessary to leave the Replace dialog
to apply the highlight, as this can be made part of the search by selecting
Format | Highlight in the "Replace with" box.
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
"ISay" <ISay RemoveThis @discussions.microsoft.com> wrote in message
news:0992E161-9ADD-41FC-9896-309416E19D7A@microsoft.com...
> Thanks, following your link I was able to find the solution.
>
> 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.
>
> "Lene Fredborg" wrote:
>
>> Something has been wrong in the Microsoft Discussion Groups for some
>> time.
>> There is a delay in showing replies posted from elsewhere (sometimes for
>> days
>> and maybe some replies never appear). Currently, 5 replies have been
>> given to
>> your question(s) but I can see that none of them appear in the Microsoft
>> Discussion Groups yet. The thread can be read here:
>>
>> http://groups.google.com/group/microsoft.public.word.docmanagement/bro..._thread
>>
>> 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
>>
>
> |
|
| Back to top |
|
 |
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
| |
|
|