Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2008

Tip: Looking for answers? Try searching our database.

Underline text surrounded by quotes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Angie M. - 22 Feb 2007 17:43 GMT
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.
jille - 22 Feb 2007 21:04 GMT
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

> 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.
Greg Maxey - 22 Feb 2007 21:14 GMT
> Hi Angie,
>
[quoted text clipped - 26 lines]
>
> - 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
Elessvie - 22 Feb 2008 19:13 GMT
> > Hi Angie,
> >
[quoted text clipped - 50 lines]
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.