Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Find and Replace Adjacent Capitals
I read in other forum threads that Word 2002 will not correct a word in all
caps that contains only two characters because it would correct Postal Service abbreviations. I still have to search documents for instances where I did not release the shift key in time and have sentences beginning with HE, IN, WE, etc., and tried to define this condition in the Find and Replace window. I could not come up with the right combination of parameters. Is there a way to search for any letter or character that is capitalized in Arial or Times New Roman? Can that be expanded to search for any two adjacent letters that have been capitalized, like my examples above, or State abbreviations, and manually correct them if needed? Thanks -- ed |
#2
|
|||
|
|||
A macro containing the following code should do what you want:
Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[A-Z]{2} ", MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True Selection.Range.Case = wdTitleWord Loop End With For an explanation of the use of wildcards, see the article "Finding and replacing characters using wildcards" at: http://word.mvps.org/FAQs/General/UsingWildcards.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "ed9213" wrote in message ... I read in other forum threads that Word 2002 will not correct a word in all caps that contains only two characters because it would correct Postal Service abbreviations. I still have to search documents for instances where I did not release the shift key in time and have sentences beginning with HE, IN, WE, etc., and tried to define this condition in the Find and Replace window. I could not come up with the right combination of parameters. Is there a way to search for any letter or character that is capitalized in Arial or Times New Roman? Can that be expanded to search for any two adjacent letters that have been capitalized, like my examples above, or State abbreviations, and manually correct them if needed? Thanks -- ed |
#3
|
|||
|
|||
Doug,
Thanks for the macro code. When I pasted it into the Visual Basic Editor and tried to run it, I received a compile error: invalid outside procedure. I'm not very familiar with the editor, so perhaps there is significance in the Do While ... routine was converted to Red text in the editor, and the word wdStory was highlighted. Is this simple to resolve? Thanks. -- ed "Doug Robbins" wrote: A macro containing the following code should do what you want: Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[A-Z]{2} ", MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True Selection.Range.Case = wdTitleWord Loop End With For an explanation of the use of wildcards, see the article "Finding and replacing characters using wildcards" at: http://word.mvps.org/FAQs/General/UsingWildcards.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "ed9213" wrote in message ... I read in other forum threads that Word 2002 will not correct a word in all caps that contains only two characters because it would correct Postal Service abbreviations. I still have to search documents for instances where I did not release the shift key in time and have sentences beginning with HE, IN, WE, etc., and tried to define this condition in the Find and Replace window. I could not come up with the right combination of parameters. Is there a way to search for any letter or character that is capitalized in Arial or Times New Roman? Can that be expanded to search for any two adjacent letters that have been capitalized, like my examples above, or State abbreviations, and manually correct them if needed? Thanks -- ed |
#4
|
|||
|
|||
See http://www.gmayor.com/installing_macro.htm
Doug's code was split permaturely in the e-mail editor. Try Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[A-Z]{2} ", _ MatchWildcards:=True, _ Wrap:=wdFindContinue, Forward:=True) = True Selection.Range.Case = wdTitleWord Loop End With http://www.gmayor.com/replace_using_wildcards.htm explains how to search for particular combinations of characters. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ed9213 wrote: Doug, Thanks for the macro code. When I pasted it into the Visual Basic Editor and tried to run it, I received a compile error: invalid outside procedure. I'm not very familiar with the editor, so perhaps there is significance in the Do While ... routine was converted to Red text in the editor, and the word wdStory was highlighted. Is this simple to resolve? Thanks. A macro containing the following code should do what you want: Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[A-Z]{2} ", MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True Selection.Range.Case = wdTitleWord Loop End With For an explanation of the use of wildcards, see the article "Finding and replacing characters using wildcards" at: http://word.mvps.org/FAQs/General/UsingWildcards.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "ed9213" wrote in message ... I read in other forum threads that Word 2002 will not correct a word in all caps that contains only two characters because it would correct Postal Service abbreviations. I still have to search documents for instances where I did not release the shift key in time and have sentences beginning with HE, IN, WE, etc., and tried to define this condition in the Find and Replace window. I could not come up with the right combination of parameters. Is there a way to search for any letter or character that is capitalized in Arial or Times New Roman? Can that be expanded to search for any two adjacent letters that have been capitalized, like my examples above, or State abbreviations, and manually correct them if needed? Thanks -- ed |
#5
|
|||
|
|||
Graham,
Thanks for the revision. I still get an "invalid outside procedure" error when I run this macro, also. The only indication of what might be causing it is the word "wdStory" was highlighted when the error box came up. Should that be altered somehow? Thanks. -- ed "Graham Mayor" wrote: See http://www.gmayor.com/installing_macro.htm Doug's code was split permaturely in the e-mail editor. Try Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[A-Z]{2} ", _ MatchWildcards:=True, _ Wrap:=wdFindContinue, Forward:=True) = True Selection.Range.Case = wdTitleWord Loop End With http://www.gmayor.com/replace_using_wildcards.htm explains how to search for particular combinations of characters. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ed9213 wrote: Doug, Thanks for the macro code. When I pasted it into the Visual Basic Editor and tried to run it, I received a compile error: invalid outside procedure. I'm not very familiar with the editor, so perhaps there is significance in the Do While ... routine was converted to Red text in the editor, and the word wdStory was highlighted. Is this simple to resolve? Thanks. A macro containing the following code should do what you want: Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[A-Z]{2} ", MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True Selection.Range.Case = wdTitleWord Loop End With For an explanation of the use of wildcards, see the article "Finding and replacing characters using wildcards" at: http://word.mvps.org/FAQs/General/UsingWildcards.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "ed9213" wrote in message ... I read in other forum threads that Word 2002 will not correct a word in all caps that contains only two characters because it would correct Postal Service abbreviations. I still have to search documents for instances where I did not release the shift key in time and have sentences beginning with HE, IN, WE, etc., and tried to define this condition in the Find and Replace window. I could not come up with the right combination of parameters. Is there a way to search for any letter or character that is capitalized in Arial or Times New Roman? Can that be expanded to search for any two adjacent letters that have been capitalized, like my examples above, or State abbreviations, and manually correct them if needed? Thanks -- ed |
#6
|
|||
|
|||
Change the line to:
Selection.HomeKey Unit:=wdStory -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ed9213 wrote: Graham, Thanks for the revision. I still get an "invalid outside procedure" error when I run this macro, also. The only indication of what might be causing it is the word "wdStory" was highlighted when the error box came up. Should that be altered somehow? Thanks. See http://www.gmayor.com/installing_macro.htm Doug's code was split prematurely in the e-mail editor. Try Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[A-Z]{2} ", _ MatchWildcards:=True, _ Wrap:=wdFindContinue, Forward:=True) = True Selection.Range.Case = wdTitleWord Loop End With http://www.gmayor.com/replace_using_wildcards.htm explains how to search for particular combinations of characters. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ed9213 wrote: Doug, Thanks for the macro code. When I pasted it into the Visual Basic Editor and tried to run it, I received a compile error: invalid outside procedure. I'm not very familiar with the editor, so perhaps there is significance in the Do While ... routine was converted to Red text in the editor, and the word wdStory was highlighted. Is this simple to resolve? Thanks. A macro containing the following code should do what you want: Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[A-Z]{2} ", MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True Selection.Range.Case = wdTitleWord Loop End With For an explanation of the use of wildcards, see the article "Finding and replacing characters using wildcards" at: http://word.mvps.org/FAQs/General/UsingWildcards.htm -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "ed9213" wrote in message ... I read in other forum threads that Word 2002 will not correct a word in all caps that contains only two characters because it would correct Postal Service abbreviations. I still have to search documents for instances where I did not release the shift key in time and have sentences beginning with HE, IN, WE, etc., and tried to define this condition in the Find and Replace window. I could not come up with the right combination of parameters. Is there a way to search for any letter or character that is capitalized in Arial or Times New Roman? Can that be expanded to search for any two adjacent letters that have been capitalized, like my examples above, or State abbreviations, and manually correct them if needed? Thanks -- ed |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find and Replace GREEK symbols in XP, 2K & 97 | Microsoft Word Help | |||
Problem with function "Find and Replace" in Word. | Microsoft Word Help | |||
Find and Replace | New Users | |||
Find and Replace anomaly | Microsoft Word Help | |||
find and replace symbols | New Users |