View Single Post
  #4   Report Post  
Graham Mayor
 
Posts: n/a
Default

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