Group: microsoft.public.word.vba.general
From: =?Utf-8?B?RWxlc3N2aWU=?=
Date: Friday, February 22, 2008 1:13 PM
Subject: Re: Underline text surrounded by quotes

"Greg Maxey" wrote:

> On Feb 22, 4:04 pm, jille wrote:
> > Hi Angie,
> >
> > It's best to simply do a search & replace. You will use the search string of
> > "*", and replace with nothing but change the format to underline for the
> > replace string only.
> >
> > Two things to ensure:
> > -the use wildcards option is active (it's a checkbox in the S&R dialog box)
> > -you use the correct representation of your quotation marks...just copy and
> > paste them into the search string box
> >
> > Once you're done just do another search and replace to take out the
> > quotation marks. (ie. search for " and replace with nothing, and search for "
> > and replace with nothing.
> >
> > One final thought...I would assume that you haven't used a single quotation
> > mark anywhere, yes?
> >
> > Good luck,
> >
> > Jille
> >
> >
> >
> > "Angie M." wrote:
> > > Hello,
> >
> > > I have a long document that contains hundreds of phrases in quotation marks.
> > > Now they want everything in quotation marks to be underlined. Can you
> > > assign a range object to text in quotes (not sure how to do that) or is there
> > > another way to approach this problem? Thanks for the help.- Hide quoted text -
> >
> > - Show quoted text -
>
> I just happened to have this around:
>
> Sub FindAndUnderlineTextInQuotes()
> 'Underlines text exclusive of the quotes marks
> Dim oRng As Range
> Set oRng = ActiveDocument.Content
>
> With oRng.Find
> .ClearFormatting
> .Text = """<*>"""
> .Forward = True
> .Wrap = wdFindStop
> .MatchWildcards = True
> Do While .Execute
> With oRng
> .MoveEnd Unit:=wdCharacter, Count:=-1
> .MoveStart Unit:=wdCharacter, Count:=1
> .Font.Underline = True
> .Collapse wdCollapseEnd
> End With
> Loop
> End With
> End Sub

Hello, Angie, Jillie and Greg --

Thank you for your posts. And, thanks to this great discussion group, I've
been using your macro, Greg, and it's been working great UNLESS it comes
across a series of words or phrases, each in quotes (like: "APPLE"
"PAVEMENT" and "NEW TREES"). Then, the macro underlines everything between
the quotes right before APPLES and the quotes right after TREES, including
spaces and the other quotes.

What do I have to do get the macro to underline only each individual word in
that series, not the whole list?

Thanks for any help you can offer.

-Lynne