macropod:
On the last line of your code there is an extra } and a quote character. Is
this intentional? Here is the line in question:
"Page {={PAGE}-{REF {QUOTE Section{={SECTION}-1}}}} of {SECTIONPAGES}"}
Here is what i receive after entering the code:
“Page !Syntax Error, ! of 3â€
I turned on the option to show non-printing characters so i was sure to
enter the code exactly as you posted.
I follow all of your logic in designing this code. I can troubleshoot this
but i do not know the meaning of the QUOTE command. I cannot find it
documented anywhere. I understand that PAGE tells you the current page
number, NUMPAGES gives the total number of pages in the doc, SECTIONPAGES
gives the number of pages in the section, SECTION gives the number of the
current section. i know the stated meaning of REF but am not yet sure of its
exact meaning (in actual practice). But once i understand the command QUOTE
i think i can figure out "how" you set this up.
Once again, thanks for your help for this assistance. I opologize for being
a "doofer" about this. I suspect this all so simple and clear to you like
when i am trying to explain C# code to someone new.
wjprice
macropod said:
Hi wjprice,
For the field code I posted, all the field braces (ie '{}') must be created in pairs via Ctrl-F9 - you can't simply type them or
copy & paste them from my post. The field code is necessarily complicated due to the way Word works. Note that you need to pay
careful attention to the spacing I've shown in the field code - leave any of the spaces out of the IF & SET fields and they'll
likely fail.
The field works by creating a series of bookmarks named Section# (where # is the Section number) and assigning the corresponding
Section's SECTIONPAGES count to them. The code to do this is {SET {QUOTE Section{SECTION}} {PAGE}}, and is only executed on the
last
page of each Section, via the IF{={SECTIONPAGES}+{REF {QUOTE Section{={SECTION}-1}}}}={PAGE} test. The code then deducts the
previous Section's page count from the current page number to determine the current Section page# for the X of Y numbering for
the
Section.
The {SET Section0 0} field is needed on the first page of the document because there's no Section 0 and the code would generate
an
error without it The IF{PAGE}<>{NUMPAGES} test is needed to prevent the code adding an unwanted bookmark for the last Section;
otherwise the output for the last Section becomes unstable.
Once you've created the field and updated it the first time (via F9), it'll automatically calculate the 'Page X of Y' expression
for
each Section, without the need for the Section unlinking I referred to earlier.
--
Cheers
macropod
[Microsoft MVP - Word]
I thank each of you for helping me with this situation. I have tried to
follow each of your posts and use them. Alas! I have NOT been able to use
your latest two examples. I do not know enough about Word formulas to
interpet your examples althuogh i think i follow the logic.
When i attempt to use field codes such as Numpages or Section i get an error
(undefined). The QUOTE you are using is undefined (unless it means to insert
a quote...single or double). I have tried both to no avai.
I will continue to follow any posts you provide.
Again thank you, eventually i will absorb enough to solve this problem. To
restate: I have XX of XXX in the header which should not be affected by
whatever i do in the footer. In the footer (only for the appendices) i want
it to show A-1, A-2, etc. for each appendix. I will change to B-1, B-2, etc.
for the next appendex and so on.
At this point it is easier to manually do it. But there has to be a way to
automate this process since on my site there are many others who will create
and/or edit documents such as this.
wjprice
:
Would it not be simpler to put a bookmarked SectionPages (hidden by
formatting it white) into each section and use an IF formula. So S2 would
have IF NumPages - Bookmark 1, S3 would have IF NumPages - (Bookmark 1 +
Bookmark 2) and so on? (If not simpler, then this simpleton would understand
it better.) <g>
Terry
Hi Terry,
A suitable formula field is:
{QUOTE{IF{PAGE}= 1 {SET Section0 0}}
{IF{PAGE}<>{NUMPAGES} {IF{={SECTIONPAGES}+{REF {QUOTE
Section{={SECTION}-1}}}}={PAGE} {SET {QUOTE Section{SECTION}} {PAGE}}}}
"Page {={PAGE}-{REF {QUOTE Section{={SECTION}-1}}}} of {SECTIONPAGES}"}
--
Cheers
macropod
[Microsoft MVP - Word]
Stefan
I have reread the original question and I see that I misunderstood. The
user wants a running page count for the total document and a running page
count for each section!
So you do need to disable the Link to Previous and it will need formulae
fields.
Sorry to have confused the issue.
Terry
Hmm, even though you can use SECTIONPAGES to count the number of pages
in
each section, and the NUMPAGES field to count the total number of pages
in
the document, I don't see how you can get both running page numbers (1,
2, 3, ..., NUMPAGES) and "section-based" page numbers (1, 2, ...,
SECTIONPAGES) without using formula fields?
--
Stefan Blom
Microsoft Word MVP
Actually, for what you want (or at least I think you want), you do not
need to unlink the H&Fs. All you need to do is put the Pages X of Y
fields
in the Header and the section pages of section field in the footer.
The header will display something like: Page 66 of 128
The footer will display something like: Page 19 of Section 3
Is that what you need?
--
Terry Farrell - MSWord MVP
Help! I would like to have page numbering in both the header and the
footer.
But, the numbering should NOT be linkied together. The header will
contain
a continuous numbering of ALL pages in the document. The footer will
contain
only the numbering for the section(s).