Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2006

Tip: Looking for answers? Try searching our database.

paragraph

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MarcoPolo - 04 Feb 2006 10:05 GMT
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???

"
Doug Robbins - Word MVP - 04 Feb 2006 10:50 GMT
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

Signature

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

>I have a funny text composition with many (too many) paragraphes.
> For example
[quoted text clipped - 10 lines]
>
> "
MarcoPolo - 04 Feb 2006 12:02 GMT
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

> Use a wildcard Find and Replace with
>
[quoted text clipped - 24 lines]
>>
>> "
Helmut Weber - 04 Feb 2006 12:44 GMT
Hi,

> Selection.Find.ClearFormatting
> Selection.Find.Replacement.ClearFormatting
[quoted text clipped - 6 lines]
>           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

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

MarcoPolo - 04 Feb 2006 12:55 GMT
Genau Helmut

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

> Hi,
>
[quoted text clipped - 18 lines]
>
> HTH
Helmut Weber - 04 Feb 2006 13:11 GMT
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/microsoft.public.word.vba.general/browse_frm/threa
d/6aa9f8ea2fe34dde/9e7e5b6fdd460cde?lnk=st&q=purgedocend+group%3Amicrosoft.publi
c.*+author%3AHelmut+author%3AWeber&rnum=1&hl=de#9e7e5b6fdd460cde


One line, of course.

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

MarcoPolo - 04 Feb 2006 13:39 GMT
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
> Hi,
>
[quoted text clipped - 16 lines]
>
> One line, of course.
Helmut Weber - 04 Feb 2006 13:49 GMT
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

Signature

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

MarcoPolo - 04 Feb 2006 14:05 GMT
I found the isSpace function, ididnt read it all sorry
IT WORKS NOW DANKE SCHÖN !!!!!!!!!!!!!!!!

> Hi Marco,
>
[quoted text clipped - 11 lines]
>
> HTH
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.