Can anyone help with the following, please?

I have a document with a large number of sections. My cursor will be
in the footer of a randomly selected section from which I need to step
forward through each one checking a sequence until the last section is
reached.

In the normal course of events I might use an "On error..." statement
which would occur when arriving at the last section and my code asks
for another one. I would exit from the routine at this point as the
error would be trapped.

However, in this instance, when I arrive at the last section whilst
still in the footers and update my sequence the cursor flips back to
the previous section. The code continues to ask for the next section
and therefore a loop is generated.

I know how to determine the number of sections in a document and also
know how to go to the last one as well as stepping through each
section.

But how can I find out when I've arrived at the last section after
each step through? Is there a way of comparing the index of the
section the cursor is located against the total number of sections?

Regards

Roderick O'Regan

Re: Sections: Index and Count by Helmut

Helmut
Sun Nov 14 04:39:04 CST 2004

Hi Roderick,
apart from possible complications,
if ActiveDocument.Sections.Count =
Selection.Information(wdActiveEndSectionNumber) then
I'd say, you have arrived at the last section.
---
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word XP, Win 98
http://word.mvps.org/


Re: Sections: Index and Count by Roderick

Roderick
Thu Nov 18 17:17:15 CST 2004

Thank you Helmut. It works just as required

Roderick


On Sun, 14 Nov 2004 11:39:04 +0100, Helmut Weber
<elmkqznfwvccbf@mailinator.com> wrote:

>Hi Roderick,
>apart from possible complications,
>if ActiveDocument.Sections.Count =
>Selection.Information(wdActiveEndSectionNumber) then
>I'd say, you have arrived at the last section.
>---
>Greetings from Bavaria, Germany
>Helmut Weber, MVP
>"red.sys" & chr(64) & "t-online.de"
>Word XP, Win 98
>http://word.mvps.org/