PDA

View Full Version : Getting rid of returns



QuietRiot
07-09-2007, 11:26 AM
is it possible to get rid of returns

so if its

this is a test
this is a test


i want

this is a test this is a test

mdmackillop
07-09-2007, 11:37 AM
From the Edit menu
Edit/Replace/More/Special

Select the break you wish to replace in the Find box
Enter Space in the Replace box

ReplaceAll

matthewspatrick
07-09-2007, 11:47 AM
No VBA required. Just do a Find/Replace, with the find being ^p and the replace being a space.

fumei
07-09-2007, 12:37 PM
Gentlemen, I would like to point out that while your posts very true, and accurate, there may very well be a legitimate use of VBA for this.

Suppose you only wanted to perform the action on a specific chunk? Say, on a Selection. Using Find/Replace as suggested forces you to click No when Word wants to keep going on the rest of the document. Which it does by default.

I can very see a legitimate use of a macro (say hotkey fired) that only does the replace on the Selection. Make a selection, hit the hotkey...boom, done. No clicking No on the "Do you want to search the remainder of the document?"

Or maybe the affected chunks are in bookmarks. Say the bookmarks filled by some other application, and you only want to perform the action on them. You do not want to touch any other part of the document.Dim objBookmark As Bookmark
Dim r As Range
For Each objBookmark In ActiveDocument.Bookmarks
Set r = objBookmark.Range
With r.Find
.Text = "^p"
.Replacement.Text = " "
.Execute Replace:=wdReplaceAll
End With
Next
So I am certainly NOT disagreeing with you. And it is most likely that the OP is looking for the global solution/answer you have suggested. Still, it is not the only valid answer. You are making assumptions.

mdmackillop
07-09-2007, 01:23 PM
You are making assumptions.
Assumptions? Not at all!
I happened to offer a simple solution. If the OP needs VBA, he can record a macro while carrying out the Replace routine. :beerchug:

EricFletcher
07-10-2007, 07:42 AM
Very possible -- and easy. In Find & Replace, change ^p to a space. The "^p" represents a return; more specifically, the paragraph end marker which displays as ? when you turn on the View All option (with the toggle button showing that symbol). You can see the full set of otherwise invisible characters if you click the More button in the F&R dialog and use the Special button.

fumei
07-10-2007, 04:18 PM
Sorry Malcolm. Didn't want to get your dander up. I was responding more to the "No VBA required." statement.

mea culpa.