Group: microsoft.public.word.vba.general
From: "Klaus Linke"
Date: Wednesday, March 19, 2008 2:04 PM
Subject: Re: Find, move down two lines, insert page break

Hi Allison,

It's not too difficult using a wildcard replacement:

With wildcards it's pretty easy too...

Check "Match wildcards",
Find what: -{3,}^13([!13]@^13)
Replace with: \1^m

-{3;} matches 3 or more hyphens, ^13 a paragraph mark, [!^13] any character
*but* a paragraph mark, and [!^13]@ any number of such aforementioned
characters.
(In some language versions, you have to use {3;} ... depending on whether
the field delimiter in your language is a comma or a semicolon.

Put together, -{3,}^13 matches a lot of hyphens hyphens followed by a
paragraph mark, ([!13]@^13) any paragraph.

Since I've put (brackets) around the latter expression, I can re-use the
matched text in the replacement, using \1 ... and ^m is a manual page break.

Regards,
Klaus






"Allison" wrote:
> Word 2003, Windows XP SP2
>
> Hi all,
>
> I posted this in word.domanagement before I found this programming group.
> It should probably be posted here.
>
> I have a text document with hundreds of pages. I need to go through and
> make sure that each new area begins a new page.
>
> Each new area begins two lines after a row of hyphens. The row following
> the row of hyphens varies, so I can't simply replace that row with the
> data
> followed by a page break.
>
> Any suggestions how to do this automatically or programmatically?
>
> Sample of data:
>
> end of prior section
> ------------- (entire row of hyphens)
> more text here that varies
> begin new section here
>
> Thanks for your help.

Safety Articles | Usenet Groups | Usenet News | Bluegrass