Hi Rick,
If you select the first Next Page break, change it to a Continuous page
break, and then delete all the "text between what *had been* Next
Page Section Breaks, starting from my current cursor position to end of
document", then you will not have any other Next Page breaks. Did you mean,
as you show in your pseudo-code to delete from the beginning of the selected
section to the end of the selected section?
"So the headers remain untouched". Well, by changing the section breaks, you
risk losing that. That is, when you change a Next Page break to a Continuous
page break, then (at a minimum) the first heading will not be until the
first page of the new section. (I hope this makes sense.)
> Both this code and Greg's work perfectly in Word 2000; THANK YOU VERY
> MUCH. My ultimate need: change all Section Breaks to Continuous, AND
[quoted text clipped - 31 lines]
> > > Is there VBA code to search for a section break, then convert it from a
> > > New Page Section Break to a Continuous Section Break? Thanks.
Rick Charnes - 25 Jan 2005 19:56 GMT
> Hi Rick,
>
[quoted text clipped - 4 lines]
> as you show in your pseudo-code to delete from the beginning of the selected
> section to the end of the selected section?
Yeah, loop through all sections and delete text therein. How would I
code that?
> "So the headers remain untouched". Well, by changing the section breaks, you
> risk losing that. That is, when you change a Next Page break to a Continuous
> page break, then (at a minimum) the first heading will not be until the
> first page of the new section. (I hope this makes sense.)
Right. I was worried about that happening, but after I run your code
and the Section Breaks are miraculously changed, the headers that I need
(First Page and Primary from pp. 1 and 2) are perfect.
Dave Lett - 25 Jan 2005 20:18 GMT
Hi Rick,
I think the following does the trick:
Dim iSec As Integer
Dim oRng As Range
For iSec = ActiveDocument.Sections.Count To 2 Step -1
With ActiveDocument.Sections(iSec).Range.PageSetup
If .SectionStart = wdSectionNewPage Then
.SectionStart = wdSectionContinuous
Set oRng = ActiveDocument.Sections(iSec).Range
oRng.MoveEnd Unit:=wdCharacter, Count:=-1
oRng.delete
End If
End With
Next iSec
HTH,
Dave
> > Hi Rick,
> >
[quoted text clipped - 16 lines]
> and the Section Breaks are miraculously changed, the headers that I need
> (First Page and Primary from pp. 1 and 2) are perfect.