I need a function that will delete all manual page breaks in a document. Can
someone please post example code to do this?

Thanks much in advance.

RE: Delete all manual page breaks by quartz

quartz
Tue Feb 01 15:13:08 CST 2005

Sorry I didn't specify before, this would include section breaks, etc.

"quartz" wrote:

> I need a function that will delete all manual page breaks in a document. Can
> someone please post example code to do this?
>
> Thanks much in advance.

Re: Delete all manual page breaks by G

G
Tue Feb 01 15:53:03 CST 2005

With ActiveDocument.Range.Find
.Text = "^m"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With


Re: Delete all manual page breaks by Vince

Vince
Wed Feb 02 03:27:16 CST 2005

This in addition too
With ActiveDocument.Range.Find
.Text = "^p"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With

"G.G.Yagoda" <nononyet@aol.com> wrote in message
news:1107294783.754244.130330@l41g2000cwc.googlegroups.com...
> With ActiveDocument.Range.Find
> .Text = "^m"
> .Replacement.Text = ""
> .Execute Replace:=wdReplaceAll
> End With
>



Re: Delete all manual page breaks by Dave

Dave
Wed Feb 02 06:25:15 CST 2005

Hi Vince,

This isn't quite right. "^p" will replace every paragraph in the document
with nothing, and you will be left with a document that has only one
paragraph (i.e., the last one).

HTH,
Dave

"Vince" <sdsad@fsd.com> wrote in message
news:%23rX2klQCFHA.3740@TK2MSFTNGP09.phx.gbl...
> This in addition too
> With ActiveDocument.Range.Find
> .Text = "^p"
> .Replacement.Text = ""
> .Execute Replace:=wdReplaceAll
> End With
>
> "G.G.Yagoda" <nononyet@aol.com> wrote in message
> news:1107294783.754244.130330@l41g2000cwc.googlegroups.com...
> > With ActiveDocument.Range.Find
> > .Text = "^m"
> > .Replacement.Text = ""
> > .Execute Replace:=wdReplaceAll
> > End With
> >
>
>



Re: Delete all manual page breaks by quartz

quartz
Wed Feb 02 07:19:04 CST 2005

Thanks Dave for the warning. Do these solutions work for section breaks as
well? I tried this code, but it seems it has no effect on section breaks...

Thanks in advance.

"Dave Lett" wrote:

> Hi Vince,
>
> This isn't quite right. "^p" will replace every paragraph in the document
> with nothing, and you will be left with a document that has only one
> paragraph (i.e., the last one).
>
> HTH,
> Dave
>
> "Vince" <sdsad@fsd.com> wrote in message
> news:%23rX2klQCFHA.3740@TK2MSFTNGP09.phx.gbl...
> > This in addition too
> > With ActiveDocument.Range.Find
> > .Text = "^p"
> > .Replacement.Text = ""
> > .Execute Replace:=wdReplaceAll
> > End With
> >
> > "G.G.Yagoda" <nononyet@aol.com> wrote in message
> > news:1107294783.754244.130330@l41g2000cwc.googlegroups.com...
> > > With ActiveDocument.Range.Find
> > > .Text = "^m"
> > > .Replacement.Text = ""
> > > .Execute Replace:=wdReplaceAll
> > > End With
> > >
> >
> >
>
>
>

Re: Delete all manual page breaks by Dave

Dave
Wed Feb 02 08:52:03 CST 2005

Hi quartz,

"^m" is only for manual page breaks; you can use the following to remove
manual page breaks and section breaks:

With Selection.Find
.ClearFormatting
''' replace section breaks
.Text = "^b"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
''' replace manual page breaks
.Text = "^m"
.Execute Replace:=wdReplaceAll
End With

HTH,
Dave

"quartz" <quartz@discussions.microsoft.com> wrote in message
news:2B6EE42B-AE15-481C-A87B-2399EC2A7D2D@microsoft.com...
> Thanks Dave for the warning. Do these solutions work for section breaks as
> well? I tried this code, but it seems it has no effect on section
breaks...
>
> Thanks in advance.
>
> "Dave Lett" wrote:
>
> > Hi Vince,
> >
> > This isn't quite right. "^p" will replace every paragraph in the
document
> > with nothing, and you will be left with a document that has only one
> > paragraph (i.e., the last one).
> >
> > HTH,
> > Dave
> >
> > "Vince" <sdsad@fsd.com> wrote in message
> > news:%23rX2klQCFHA.3740@TK2MSFTNGP09.phx.gbl...
> > > This in addition too
> > > With ActiveDocument.Range.Find
> > > .Text = "^p"
> > > .Replacement.Text = ""
> > > .Execute Replace:=wdReplaceAll
> > > End With
> > >
> > > "G.G.Yagoda" <nononyet@aol.com> wrote in message
> > > news:1107294783.754244.130330@l41g2000cwc.googlegroups.com...
> > > > With ActiveDocument.Range.Find
> > > > .Text = "^m"
> > > > .Replacement.Text = ""
> > > > .Execute Replace:=wdReplaceAll
> > > > End With
> > > >
> > >
> > >
> >
> >
> >



Re: Delete all manual page breaks by Vince

Vince
Wed Feb 02 19:07:27 CST 2005

Thanks Dave. Sorry about that Quartz.

"Dave Lett" <dlett@NOsmconst.comSPAM.com> wrote in message
news:euZLDbTCFHA.1264@TK2MSFTNGP12.phx.gbl...
> Hi quartz,
>
> "^m" is only for manual page breaks; you can use the following to remove
> manual page breaks and section breaks:
>
> With Selection.Find
> .ClearFormatting
> ''' replace section breaks
> .Text = "^b"
> .Replacement.Text = ""
> .Execute Replace:=wdReplaceAll
> ''' replace manual page breaks
> .Text = "^m"
> .Execute Replace:=wdReplaceAll
> End With
>
> HTH,
> Dave
>
> "quartz" <quartz@discussions.microsoft.com> wrote in message
> news:2B6EE42B-AE15-481C-A87B-2399EC2A7D2D@microsoft.com...
> > Thanks Dave for the warning. Do these solutions work for section breaks
as
> > well? I tried this code, but it seems it has no effect on section
> breaks...
> >
> > Thanks in advance.
> >
> > "Dave Lett" wrote:
> >
> > > Hi Vince,
> > >
> > > This isn't quite right. "^p" will replace every paragraph in the
> document
> > > with nothing, and you will be left with a document that has only one
> > > paragraph (i.e., the last one).
> > >
> > > HTH,
> > > Dave
> > >
> > > "Vince" <sdsad@fsd.com> wrote in message
> > > news:%23rX2klQCFHA.3740@TK2MSFTNGP09.phx.gbl...
> > > > This in addition too
> > > > With ActiveDocument.Range.Find
> > > > .Text = "^p"
> > > > .Replacement.Text = ""
> > > > .Execute Replace:=wdReplaceAll
> > > > End With
> > > >
> > > > "G.G.Yagoda" <nononyet@aol.com> wrote in message
> > > > news:1107294783.754244.130330@l41g2000cwc.googlegroups.com...
> > > > > With ActiveDocument.Range.Find
> > > > > .Text = "^m"
> > > > > .Replacement.Text = ""
> > > > > .Execute Replace:=wdReplaceAll
> > > > > End With
> > > > >
> > > >
> > > >
> > >
> > >
> > >
>
>



Re: Delete all manual page breaks by quartz

quartz
Tue Feb 08 12:47:01 CST 2005

No harm, no foul.

"Vince" wrote:

> Thanks Dave. Sorry about that Quartz.
>
> "Dave Lett" <dlett@NOsmconst.comSPAM.com> wrote in message
> news:euZLDbTCFHA.1264@TK2MSFTNGP12.phx.gbl...
> > Hi quartz,
> >
> > "^m" is only for manual page breaks; you can use the following to remove
> > manual page breaks and section breaks:
> >
> > With Selection.Find
> > .ClearFormatting
> > ''' replace section breaks
> > .Text = "^b"
> > .Replacement.Text = ""
> > .Execute Replace:=wdReplaceAll
> > ''' replace manual page breaks
> > .Text = "^m"
> > .Execute Replace:=wdReplaceAll
> > End With
> >
> > HTH,
> > Dave
> >
> > "quartz" <quartz@discussions.microsoft.com> wrote in message
> > news:2B6EE42B-AE15-481C-A87B-2399EC2A7D2D@microsoft.com...
> > > Thanks Dave for the warning. Do these solutions work for section breaks
> as
> > > well? I tried this code, but it seems it has no effect on section
> > breaks...
> > >
> > > Thanks in advance.
> > >
> > > "Dave Lett" wrote:
> > >
> > > > Hi Vince,
> > > >
> > > > This isn't quite right. "^p" will replace every paragraph in the
> > document
> > > > with nothing, and you will be left with a document that has only one
> > > > paragraph (i.e., the last one).
> > > >
> > > > HTH,
> > > > Dave
> > > >
> > > > "Vince" <sdsad@fsd.com> wrote in message
> > > > news:%23rX2klQCFHA.3740@TK2MSFTNGP09.phx.gbl...
> > > > > This in addition too
> > > > > With ActiveDocument.Range.Find
> > > > > .Text = "^p"
> > > > > .Replacement.Text = ""
> > > > > .Execute Replace:=wdReplaceAll
> > > > > End With
> > > > >
> > > > > "G.G.Yagoda" <nononyet@aol.com> wrote in message
> > > > > news:1107294783.754244.130330@l41g2000cwc.googlegroups.com...
> > > > > > With ActiveDocument.Range.Find
> > > > > > .Text = "^m"
> > > > > > .Replacement.Text = ""
> > > > > > .Execute Replace:=wdReplaceAll
> > > > > > End With
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> >
> >
>
>
>

Re: Delete all manual page breaks by Haydn

Haydn
Fri Sep 09 10:15:03 CDT 2005

This doesn't work when Word inserts its own section breaks. How do you
delete these or stop word from inserting its own section breaks automatically?

"Dave Lett" wrote:

> Hi quartz,
>
> "^m" is only for manual page breaks; you can use the following to remove
> manual page breaks and section breaks:
>
> With Selection.Find
> .ClearFormatting
> ''' replace section breaks
> .Text = "^b"
> .Replacement.Text = ""
> .Execute Replace:=wdReplaceAll
> ''' replace manual page breaks
> .Text = "^m"
> .Execute Replace:=wdReplaceAll
> End With
>
> HTH,
> Dave
>
> "quartz" <quartz@discussions.microsoft.com> wrote in message
> news:2B6EE42B-AE15-481C-A87B-2399EC2A7D2D@microsoft.com...
> > Thanks Dave for the warning. Do these solutions work for section breaks as
> > well? I tried this code, but it seems it has no effect on section
> breaks...
> >
> > Thanks in advance.
> >
> > "Dave Lett" wrote:
> >
> > > Hi Vince,
> > >
> > > This isn't quite right. "^p" will replace every paragraph in the
> document
> > > with nothing, and you will be left with a document that has only one
> > > paragraph (i.e., the last one).
> > >
> > > HTH,
> > > Dave
> > >
> > > "Vince" <sdsad@fsd.com> wrote in message
> > > news:%23rX2klQCFHA.3740@TK2MSFTNGP09.phx.gbl...
> > > > This in addition too
> > > > With ActiveDocument.Range.Find
> > > > .Text = "^p"
> > > > .Replacement.Text = ""
> > > > .Execute Replace:=wdReplaceAll
> > > > End With
> > > >
> > > > "G.G.Yagoda" <nononyet@aol.com> wrote in message
> > > > news:1107294783.754244.130330@l41g2000cwc.googlegroups.com...
> > > > > With ActiveDocument.Range.Find
> > > > > .Text = "^m"
> > > > > .Replacement.Text = ""
> > > > > .Execute Replace:=wdReplaceAll
> > > > > End With
> > > > >
> > > >
> > > >
> > >
> > >
> > >
>
>
>

Re: Delete all manual page breaks by Klaus

Klaus
Fri Sep 09 23:46:35 CDT 2005

Hi Haydn,

> This doesn't work when Word inserts its own section breaks.

AFAIK, Word doesn't insert its own section breaks. Are you dealing with
master documents?
http://word.mvps.org/FAQs/General/RecoverMasterDocs.htm

Or, maybe more likely, you're thinking about page breaks defined in a style,
or applied as part of the paragraph formatting?

> How do you delete these or stop word from inserting its own section breaks
> automatically?

To remove the "page break before" from all paragraph style definitions:

Sub RemoveParaBreakBefore_Style()
Dim myStyle As Style
For Each myStyle In ActiveDocument.Styles
If myStyle.Type = wdStyleTypeParagraph Then
myStyle.ParagraphFormat.PageBreakBefore = False
End If
Next myStyle
End Sub


And to remove any "page breaks before" that you may have applied manually in
the paragraph format, you could use another "Find/Replace":

Sub RemoveParaBreakBefore_Para()
Selection.Find.ClearFormatting
Selection.Find.ParagraphFormat.PageBreakBefore = True
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.ParagraphFormat.PageBreakBefore = False
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = True
.MatchWholeWord = False
.MatchByte = False
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

Regards,
Klaus