Removing Carragie returns in Word

  robert21 21:41 22 Jan 2004
Locked

Is it possible to autmate the removal of hard returns placed at the end of each line when pasting text from Web pages or mail into Word? I can remember a macro from some time ago but can't find it.

  Chris the Ancient 21:53 22 Jan 2004

The macro that you need is as follows...

Sub FixLines()

Dim dowhat

dowhat = 1

If WordBasic.SelType() = 2 Then

dowhat = 0

End If

WordBasic.editreplace Find:="^p",

Replace:="@@@", Direction:=0, ReplaceAll:=1,

Wrap:=dowhat

WordBasic.editreplace Find:="@@@@@@",

Replace:="^p^p", Direction:=0, ReplaceAll:=1,

Wrap:=dowhat

WordBasic.editreplace Find:="@@@", Replace:=" ",

Direction:=0, ReplaceAll:=1, Wrap:=dowhat

With Selection
.WholeStory
.EscapeKey
.HomeKey unit:=wdStory
.WholeStory
.Range.Case = wdUpperCase
.Range.Case = wdTitleSentence
.HomeKey unit:=wdStory

End With

End Sub

  Chris the Ancient 21:53 22 Jan 2004

New line between the last end with and end sub

  Eric10 21:54 22 Jan 2004

Can't you just use 'Edit, Replace' and replace the paragraph mark with a space. In the 'Replace' dialogue box click the 'More' button and you will find 'Paragraph Mark' and much more by clicking the 'Special' button.

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

HP Envy x2 review: Hands-on

How Sketch and InVision have revolutionised our design workflow

The best tech gifts for Christmas 2017

Les meilleurs jeux de société (2017)