FWIW the main reason I make a suggestion based on a macro is because
a. creating one bookmark at the beginning of one section may well be
simple, as the section count goes up and/or if the section structure is
subject to frequent change, then everyone has to adjust the bookmarks
every time a section is inserted/deleted, and that's tedious and
error-prone, at which case my personal view is that it's no longer simple.
b. because of that, many users/organisations are probably going to
resort to a macro to create those bookmarks
c. once you've done that, you may as well accept that running a macro
is part of the publication process
Once you've decided that /a macro/ is needed, it doesn't really matter
how you achieve the overall result, as long as it's easy to use and
reliable. DOCVARIABLEs are little more than a personal preference.
(Nor do I make any claims for the reliability of my approach
). Or
you could use your approach and have a macro to insert the bookmarks,
and as you say you can also do it without VBA if you want.
Things may get a little trickier anyway, e.g.
d. if you have continuous section breaks I think things are reasonably
straightforward, but maybe not
e. if your section structure does not correspond exactly with Word's
section structure, e.g. you had to have a Word section break to change
landscape/portrait, but you want both types of page to be numbered
within the same section. In that case with a VBA-bsed approach you'd
probably have to tailor the VBA in some way. At that point, relying on
fields that do not reference { SECTIONPAGES ] is probably going to help.
If the document is actally built from separate .doc/.docx files as the
OP has intimated, then I don't think either of our suggestions is going
to work without modification.
Incidentally, the type of "field-only" approach I have tried in the past
but which
f. doesn't work
g. can cause havoc because Word seems to end up continuously updating
header/footer fields
uses fields in the header/footer along the lines of
{SET T1 0}
{SET "T{={SECTION}+1}" {={SECTIONPAGES}+{REF "T{={SECTION}"}}}}
{={PAGE}-{REF "T{SECTION}"}}
so that if section 1 has 3 pages, section 2 has 4 pages etc. then in
theory you would get
T1=0
T2=3
T3=7
i.e. the total number of pages up to the beginning of each section.
Although this doesn't actually appear to have any recursive element in
the calculations, Word seems to re-evaluate the Tn values in some way
that causes them to grow very fast and then stop. In other words, it
pushes Word's field evalution code harder than it wants to go. But
perhaps there is some other way to do those calculations that will work.
Just my 2-c worth
Peter Jamieson
http://tips.pjmsn.me.uk