Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Island Girl Island Girl is offline
external usenet poster
 
Posts: 192
Default Find and Replace

Is there a way in the Find and Replace dialog box of telling Word to
underline a whole sentence but not the period following it?

I know how to underline the sentence with the period, but somehow I'm having
a mental block concerning leaving the period without an underline.

Here's the unbelievable part: I have a function key assigned to this very
thing, and it works every time! But I don't know whether I stumbled across a
way to do it at some point or whether one of you wonderful people wrote a
macro for it.

No matter how it got there, I'd really like to know if Find and Replace
alone can do it.

Thank you so much for helping me to be a better word processor!


  #2   Report Post  
Posted to microsoft.public.word.newusers
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Find and Replace

Somebody clever may come along and prove me wrong, but I don't think
Replace, even with wildcards, can do that trick. The reason is that
the entire replacement can have only one value for each kind of
formatting (underline, bold, etc.) -- there's no way to say "replace
part of the found text with one kind of format and the rest with
another kind". What you have to do is set things up so all the found
text requires the same format. That takes at least two steps, so a
macro is necessary.

The macro doesn't have to use Find/Replace. For example, here's one
that doesn't:

Sub UnderlineSentence()
Dim oRg As Range
Set oRg = Selection.Sentences(1)
With oRg
.Collapse wdCollapseStart
.MoveEndUntil cset:=".?!", Count:=wdForward
.Underline = wdUnderlineSingle
End With
Set oRg = Nothing
End Sub

Put the cursor anywhere inside the desired sentence and run the macro.

As for finding out what you already have: Go to Tools Customize
Keyboard. Choose any command in the dialog, put the cursor in the
"Press new shortcut key" box, and press the function key that's
already assigned to your underlining function. The dialog will show
"Currently assigned to:" followed by the name and location of the
macro. Cancel out of the dialog without making any assignment. Then
you can track down the macro and see what the code does.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sun, 7 Jan 2007 13:10:00 -0800, Island Girl
wrote:

Is there a way in the Find and Replace dialog box of telling Word to
underline a whole sentence but not the period following it?

I know how to underline the sentence with the period, but somehow I'm having
a mental block concerning leaving the period without an underline.

Here's the unbelievable part: I have a function key assigned to this very
thing, and it works every time! But I don't know whether I stumbled across a
way to do it at some point or whether one of you wonderful people wrote a
macro for it.

No matter how it got there, I'd really like to know if Find and Replace
alone can do it.

Thank you so much for helping me to be a better word processor!

  #3   Report Post  
Posted to microsoft.public.word.newusers
Island Girl Island Girl is offline
external usenet poster
 
Posts: 192
Default Find and Replace

Hi, Jay:

Thanks so much for your usual great help. As a matter of fact, it could
have been you who wrote the macro for me in the first place since, as you
indicated, it couldn't have been a find and replace that I somehow stumbled
upon. It certainly came in handy yesterday in a 182-page agreement in which
the first subject matter line of each numbered paragraph was underlined.

I really appreciate all the help you've given me in the past and now. And
thanks to all the macros and find and replace goodies you and your fellow
MVP's have provided me, my work gets easier each day.

"Jay Freedman" wrote:

Somebody clever may come along and prove me wrong, but I don't think
Replace, even with wildcards, can do that trick. The reason is that
the entire replacement can have only one value for each kind of
formatting (underline, bold, etc.) -- there's no way to say "replace
part of the found text with one kind of format and the rest with
another kind". What you have to do is set things up so all the found
text requires the same format. That takes at least two steps, so a
macro is necessary.

The macro doesn't have to use Find/Replace. For example, here's one
that doesn't:

Sub UnderlineSentence()
Dim oRg As Range
Set oRg = Selection.Sentences(1)
With oRg
.Collapse wdCollapseStart
.MoveEndUntil cset:=".?!", Count:=wdForward
.Underline = wdUnderlineSingle
End With
Set oRg = Nothing
End Sub

Put the cursor anywhere inside the desired sentence and run the macro.

As for finding out what you already have: Go to Tools Customize
Keyboard. Choose any command in the dialog, put the cursor in the
"Press new shortcut key" box, and press the function key that's
already assigned to your underlining function. The dialog will show
"Currently assigned to:" followed by the name and location of the
macro. Cancel out of the dialog without making any assignment. Then
you can track down the macro and see what the code does.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sun, 7 Jan 2007 13:10:00 -0800, Island Girl
wrote:

Is there a way in the Find and Replace dialog box of telling Word to
underline a whole sentence but not the period following it?

I know how to underline the sentence with the period, but somehow I'm having
a mental block concerning leaving the period without an underline.

Here's the unbelievable part: I have a function key assigned to this very
thing, and it works every time! But I don't know whether I stumbled across a
way to do it at some point or whether one of you wonderful people wrote a
macro for it.

No matter how it got there, I'd really like to know if Find and Replace
alone can do it.

Thank you so much for helping me to be a better word processor!


  #4   Report Post  
Posted to microsoft.public.word.newusers
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Find and Replace

:-)
You're welcome!

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

Island Girl wrote:
Hi, Jay:

Thanks so much for your usual great help. As a matter of fact, it
could have been you who wrote the macro for me in the first place
since, as you indicated, it couldn't have been a find and replace
that I somehow stumbled upon. It certainly came in handy yesterday
in a 182-page agreement in which the first subject matter line of
each numbered paragraph was underlined.

I really appreciate all the help you've given me in the past and now.
And thanks to all the macros and find and replace goodies you and
your fellow MVP's have provided me, my work gets easier each day.

"Jay Freedman" wrote:

Somebody clever may come along and prove me wrong, but I don't think
Replace, even with wildcards, can do that trick. The reason is that
the entire replacement can have only one value for each kind of
formatting (underline, bold, etc.) -- there's no way to say "replace
part of the found text with one kind of format and the rest with
another kind". What you have to do is set things up so all the found
text requires the same format. That takes at least two steps, so a
macro is necessary.

The macro doesn't have to use Find/Replace. For example, here's one
that doesn't:

Sub UnderlineSentence()
Dim oRg As Range
Set oRg = Selection.Sentences(1)
With oRg
.Collapse wdCollapseStart
.MoveEndUntil cset:=".?!", Count:=wdForward
.Underline = wdUnderlineSingle
End With
Set oRg = Nothing
End Sub

Put the cursor anywhere inside the desired sentence and run the
macro.

As for finding out what you already have: Go to Tools Customize
Keyboard. Choose any command in the dialog, put the cursor in the
"Press new shortcut key" box, and press the function key that's
already assigned to your underlining function. The dialog will show
"Currently assigned to:" followed by the name and location of the
macro. Cancel out of the dialog without making any assignment. Then
you can track down the macro and see what the code does.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Sun, 7 Jan 2007 13:10:00 -0800, Island Girl
wrote:

Is there a way in the Find and Replace dialog box of telling Word to
underline a whole sentence but not the period following it?

I know how to underline the sentence with the period, but somehow
I'm having a mental block concerning leaving the period without an
underline.

Here's the unbelievable part: I have a function key assigned to
this very thing, and it works every time! But I don't know whether
I stumbled across a way to do it at some point or whether one of
you wonderful people wrote a macro for it.

No matter how it got there, I'd really like to know if Find and
Replace alone can do it.

Thank you so much for helping me to be a better word processor!



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace all tikchye_oldLearner57 Microsoft Word Help 3 October 26th 06 12:48 PM
Find and Replace problems Jammer Microsoft Word Help 3 September 20th 06 02:57 PM
Problem with find and replace of paragragh marks kdzugan Microsoft Word Help 1 January 1st 06 09:26 PM
Find and Replace GREEK symbols in XP, 2K & 97 Jazz Microsoft Word Help 3 April 8th 05 08:13 PM
Find and Replace anomaly BruceM Microsoft Word Help 7 January 18th 05 05:47 PM


All times are GMT +1. The time now is 07:15 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"