Link to home
Start Free TrialLog in
Avatar of Andreas Hermle
Andreas HermleFlag for Germany

asked on

Changing type of section breaks in Word using VBA

I would like to change next-page section breaks into odd-page section breaks in Word using VBA. How come this code below does not work? I guess Word gets upset since the page numbering has to be rebuild completely, then?

Sub ChangeSecBrk()
Dim sec As Section
For Each sec In ActiveDocument.Sections
    If sec.PageSetup.SectionStart = wdSectionNextPage Then
        sec.PageSetup.SectionStart = wdSectionOddPage
       
    End If
Next sec
End Sub

Strangely enough, I tried to change "odd-page" section breaks into "next-page" section breaks using above VBA syntax (and adjusting the code) and the odd-page section breaks turned into continuous ones.
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial