View Single Post
  #12   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey[_2_] Greg Maxey[_2_] is offline
external usenet poster
 
Posts: 668
Default how can i underline only 5 letter words?

Are you disagreeing with "Find: [! ]{3} Replace with: ^& formatted with
underline" is not a macro?


Suzanne S. Barnhill wrote:
Agreed that "five characters" may not be the same as "five letters."


"Greg Maxey" wrote in
message ...
While wrong for the task at hand (Sorry), Find: [! ]{3} Replace
with: ^& formatted with underline" is not a macro.

It is wrong, because I copied it from an old reference I had for
finding three letter words. I wasn't disputing Stephan's proposal. If
fact I didn't even see it.

Looking at the issue a little closer ????? may not completely fit
the bill. Is "don't" a five letter word, four letter word with an
apostrophe, a four letter word, or a two letter word connected to a
three letter word with an apostrophe? Is $12.95 a five letter
word?, is a five character zip code a five letter word or a just a
number? I suppose if one is just looking for words spelled with
five letters of the alphabet then something like:

Find: [A-Za-z]{5}

may be more desirable.



Suzanne S. Barnhill wrote:
Is a macro really necessary when the simple Find operation Stefan
proposed should do the job?


"Greg Maxey" wrote in
message ...
Doug,

That misses the first word of the document if 5 characters and the
last word of a sentence if 5 characters.

This seems to work: Find: [! ]{3} Replace with: ^& formatted
with underline.


Doug Robbins - Word MVP on news.microsoft.com wrote:
Use a macro containing the following code:

Dim myRange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:=" [A-z]{5} ", Forward:=True, _
MatchWildcards:=True, Wrap:=wdFindStop, MatchCase:=False) =
True Set myRange = Selection.Range
Selection.Collapse wdCollapseEnd
myRange.Start = myRange.Start + 1
myRange.End = myRange.End - 1
myRange.Font.Underline = wdUnderlineSingle
Loop
End With



"ruan99" wrote in message
...
I have an essay written but I have to underline only the 5 letter
words in it. I do not want to go back and underline them all
individually, so I am wondering if there is a way to mass
underline only 5 letter words. Thank you

--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org


--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org