Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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. |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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) |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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) |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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 |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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 |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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 he http://groups.google.com/group/micro...ill+find+words 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. |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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 he http://groups.google.com/group/micro...ill+find+words 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 |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and highlight all instances of ALL CAPS
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" wrote in message ... 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 he http://groups.google.com/group/micro...ill+find+words 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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I find all instances of a word and delete them at once? | Microsoft Word Help | |||
Can I find all instances of a word and delete them at once? | Microsoft Word Help | |||
Highlight ALL instances of the verb "To Be" in Word 2003? | Microsoft Word Help | |||
Find all instances of a recurring text | Microsoft Word Help | |||
Find AND Display Multiple Instances | Microsoft Word Help |