paragraph

M

MarcoPolo

I have a funny text composition with many (too many) paragraphes.
For example

"AUTHOR: MALCOM WALES
(CR)

DATE: 01/01/2006


REPUBLIC OF " and so on...

how can i remove authomatically all the carriage return that i dont need
preserving the one i really need???

"
 
D

Doug Robbins - Word MVP

Use a wildcard Find and Replace with

^13{1,}

in the find what control, and

^p

in the replace with control.

See the article "Finding and replacing characters using wildcards" at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
M

MarcoPolo

what about this?

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
Do While .Execute(Replace:=wdReplaceAll) = True
Loop
End With
 
H

Helmut Weber

Hi,
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
Do While .Execute(Replace:=wdReplaceAll) = True
Loop
End With

that will not return the desired result,
if you have e.g. copied some text from a website,
or imported text or copied text in some odd format.

As chr(13) is not the same as ^p.
Searching for chr(13) finds all ^p.
But searching for ^p doesn't find every chr(13).

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

MarcoPolo

Genau Helmut

So any idea how to correct it?
i did a loop while execvute = true but it doesnt stop
 
H

Helmut Weber

Hi,

can't remember your real name.
Did you ever reveal it?

Would be much nicer.

You are encountering problems with the end-of-document mark,
which can't be replaced. A relict from former times,
when there was a diamond in DOS-Word to indicate the doc's end.

Though there isn't an end-of-doc mark anymore,
the last paragraph mark in a doc is something very special.

You would have to purge the doc's end from repeated ^p^p before.

See:
http://groups.google.de/group/micro...ut+author:Weber&rnum=1&hl=de#9e7e5b6fdd460cde

One line, of course.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

MarcoPolo

My name is really Marco Polo (like my famous "ancestor" lol) and i'm expert
of mainframe

i'm trying to delete all the double end of paragraph and you're right i find
error at end of doc

i tried the script of the link but isSpace is not recgnized
So what can i do?
Liebe grüsse aus Italien :)














I looked ta tour
 
H

Helmut Weber

Hi Marco,

Public Sub DeleteDocEnd()
Dim s As String
With ActiveDocument
If Len(.Range) = 1 Then Exit Sub
s = .Characters.Last.Previous
While s = chr(13)
.Characters.Last.Previous = ""
s = .Characters.Last.Previous
Wend
End With
End Sub

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

MarcoPolo

I found the isSpace function, ididnt read it all sorry
IT WORKS NOW DANKE SCHÖN !!!!!!!!!!!!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top