Section Break (Continuous)

F

Fuzzhead

I have documents with numerous Section Break (Continuous) in them that I want
to delete. How do I write a macro that only finds and deletes the Continuous
Section Breaks?
 
D

Doug Robbins - Word MVP on news.microsoft.com

Use:

Dim i As Long
Dim sb As Range
With ActiveDocument
For i = .Sections.Count To 2 Step -1
With .Sections(i)
If .PageSetup.SectionStart = wdSectionContinuous Then
.PageSetup.SectionStart = ActiveDocument.Sections(i -
1).PageSetup.SectionStart
Set sb = ActiveDocument.Sections(i - 1).Range
sb.End = sb.End - 1
sb.Collapse wdCollapseEnd
sb.Delete
End If
End With
Next i
End With


--
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, originally posted via msnews.microsoft.com
 
F

Fuzzhead

Thank you Doug. That worked great.

:


Use:

Dim i As Long
Dim sb As Range
With ActiveDocument
For i = .Sections.Count To 2 Step -1
With .Sections(i)
If .PageSetup.SectionStart = wdSectionContinuous Then
.PageSetup.SectionStart = ActiveDocument.Sections(i -
1).PageSetup.SectionStart
Set sb = ActiveDocument.Sections(i - 1).Range
sb.End = sb.End - 1
sb.Collapse wdCollapseEnd
sb.Delete
End If
End With
Next i
End With


--
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, originally posted via msnews.microsoft.com
 

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