Setting a range for the section preceding the first occurrence of anodd section break

A

andreas

Dear Experts:

I got a document with several 'odd page' section breaks. I would like
to set a range for the section preceding the first occurrence of an
odd section break.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
 
D

Doug Robbins - Word MVP

Use:

Dim i As Long
Dim srange As Range
With ActiveDocument
For i = 1 To .Sections.Count
If .Sections(i).PageSetup.SectionStart = wdSectionOddPage Then
Exit For
End If
Next i
Set srange = .Sections(i - 1).Range
End With
 
A

andreas

Use:

Dim i As Long
Dim srange As Range
With ActiveDocument
    For i = 1 To .Sections.Count
        If .Sections(i).PageSetup.SectionStart = wdSectionOddPage Then
            Exit For
        End If
    Next i
    Set srange = .Sections(i - 1).Range
End With

--
Hope this helps,

Doug Robbins - Word MVP
dkr[atsymbol]mvps[dot]org




Dear Experts:
I got a document with several 'odd page' section breaks. I would like
to set a range for the section preceding the first occurrence of an
odd section break.
Help is much appreciated. Thank you very much in advance.
Regards, Andreas- Zitierten Text ausblenden -

- Zitierten Text anzeigen -


Hi Doug,

that's it. Thank you very much for your professional help.

Regards, Andreas
 

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