Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Greg In Atl Greg In Atl is offline
external usenet poster
 
Posts: 6
Default Macro only selected text

I created a macro that replaces paragraph marks with a blank. I only want it
to do this for selected text. Problem is, it does it for non-selected text as
well.

How can I make this macro only perform the replacement for selected text
--
Greg in Atlanta
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Greg In Atl Greg In Atl is offline
external usenet poster
 
Posts: 6
Default Macro only selected text

I almost forgot, this is for Word 2003
--
Greg in Atlanta


"Greg In Atl" wrote:

I created a macro that replaces paragraph marks with a blank. I only want it
to do this for selected text. Problem is, it does it for non-selected text as
well.

How can I make this macro only perform the replacement for selected text
--
Greg in Atlanta

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Helmut Weber Helmut Weber is offline
external usenet poster
 
Posts: 139
Default Macro only selected text

Hi Greg In Atl,

like this:

Sub T5()
If Selection.Type = wdSelectionIP Then Exit Sub
With Selection.Range.Find
.Text = "^p"
.Replacement.Text = " "
.Execute Replace:=wdReplaceAll
End With
End Sub

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"




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
Formatting selected text auto-applies to all text! Rozonus Page Layout 1 October 11th 06 05:42 PM
Selected Style gets updated from selected text wordspinster Page Layout 3 May 20th 06 07:41 PM
Macro: Execute for Selected Text Only Pleonasm Microsoft Word Help 4 November 29th 05 11:55 PM
How do I set up a macro to set selected words typeface to Bold? Douglas McKibbin Microsoft Word Help 2 April 28th 05 10:17 PM
Macro to set selected cell padding to table default Cindy M -WordMVP- Tables 0 October 28th 04 06:09 PM


All times are GMT +1. The time now is 02:08 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"