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