Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Ed from AZ Ed from AZ is offline
external usenet poster
 
Posts: 91
Default What field shows "ThisPage of ThisSection"?

I am trying to set up an IF field in Word 2003. It needs to say:
"IF this is Page 1 of ThisSection, "THIS", IF this is LastPage of
ThisSection, "THAT", "OTHER"

But I'm having difficulty finding a field (or combination thereof?)
that will give me the page number of the section I'm in.

A drop-kick in the right direction would be appreciated.

Ed
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default What field shows "ThisPage of ThisSection"?

Hi Ed,

Word doesn't have a field for returning each page# for a given Section. However, you could use the following field code in the
header or footer:
{QUOTE{IF{PAGE}= 1 {SET Section0 0}}{IF{PAGE}={NUMPAGES} "Last Page" {IF{={SECTIONPAGES}+{REF {QUOTE Section{={SECTION}-1}}}}={PAGE}
"{SET {QUOTE Section{SECTION}} {PAGE}}Last Page" {IF{={PAGE}-{REF {QUOTE Section{={SECTION}-1}}}}= 1 "First Page" "Other Page"}}}}

How this works:
The field creates a series of bookmarks named Section# (where # is the Section number) and assigns 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.
The code then deducts the previous Section's page count from the current page number to determine the current Section page#.
If the current Section page# equals the Section page count, 'Last Page' is displayed; otherwise if the current Section page# equals
1, 'First Page' is displayed; otherwise 'Other Page' is displayed.
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.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"Ed from AZ" wrote in message ...
I am trying to set up an IF field in Word 2003. It needs to say:
"IF this is Page 1 of ThisSection, "THIS", IF this is LastPage of
ThisSection, "THAT", "OTHER"

But I'm having difficulty finding a field (or combination thereof?)
that will give me the page number of the section I'm in.

A drop-kick in the right direction would be appreciated.

Ed


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default What field shows "ThisPage of ThisSection"?

Hi Ed,

BTW, is there a reason you can't unlink each Section from the previous one and set the page numbering for each Section to start from
1? Although it's perhaps more fiddly to maintain, you could then greatly simplify the field coding:
{IF{PAGE}= 1 "First Page" {IF{PAGE}= {SECTIONPAGES} "Last Page" "Other Page"}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Ed from AZ Ed from AZ is offline
external usenet poster
 
Posts: 91
Default What field shows "ThisPage of ThisSection"?

Hi, macropod.

No, I can't restart the page numbering - this is a landscape section
in the middle of a report that's holding a table that will flow over
several pages. I need to change the table header depending on which
page I'm on. Hence, the IF with the criteria dependent on the page of
that section.

Is there a way to copy and paste this field code into the Word doc and
replace the curlys with the CTRL+F9 brackets? Saves a lot of "it
won't work because I fumbled my typing" frustrations!! 8)

Thanks for the boost!
Ed


On Apr 2, 1:37*am, "macropod" wrote:
Hi Ed,

BTW, is there a reason you can't unlink each Section from the previous one and set the page numbering for each Section to start from
1? Although it's perhaps more fiddly to maintain, you could then greatly simplify the field coding:
{IF{PAGE}= 1 "First Page" {IF{PAGE}= {SECTIONPAGES} "Last Page" "Other Page"}}

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------


  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Ed from AZ Ed from AZ is offline
external usenet poster
 
Posts: 91
Default What field shows "ThisPage of ThisSection"?

Okay - just tried it.

In the header of a new doc with two sections, it works great to
identify each page of each section as "First", "Last", or "Other".

In my report, though, it bombs! I can't get anything besides "Other
Page". I copied the code directly over - nothing changed in the
translation (I think)??

{QUOTE{IF{PAGE}= 1 {SET Section0 0}}{IF{PAGE}={NUMPAGES} "Last
Page" {IF{={SECTIONPAGES}+{REF {QUOTE Section{={SECTION}-1}}}}={PAGE}
"{SET {QUOTE Section{SECTION}} {PAGE}}Last Page" {IF{={PAGE}-{REF
{QUOTE Section{={SECTION}-1}}}}= 1 "First Page" "Other Page"}}}}

Any hints for troubleshooting why?

Ed


On Apr 2, 7:55*am, Ed from AZ wrote:
Hi, macropod.

No, I can't restart the page numbering - this is a landscape section
in the middle of a report that's holding a table that will flow over
several pages. *I need to change the table header depending on which
page I'm on. *Hence, the IF with the criteria dependent on the page of
that section.

Is there a way to copy and paste this field code into the Word doc and
replace the curlys with the CTRL+F9 brackets? *Saves a lot of "it
won't work because I fumbled my typing" frustrations!! *8)

Thanks for the boost!
Ed

On Apr 2, 1:37*am, "macropod" wrote:



Hi Ed,


BTW, is there a reason you can't unlink each Section from the previous one and set the page numbering for each Section to start from
1? Although it's perhaps more fiddly to maintain, you could then greatly simplify the field coding:
{IF{PAGE}= 1 "First Page" {IF{PAGE}= {SECTIONPAGES} "Last Page" "Other Page"}}


Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------- Hide quoted text -


- Show quoted text -




  #6   Report Post  
Posted to microsoft.public.word.docmanagement
macropod macropod is offline
external usenet poster
 
Posts: 1,002
Default What field shows "ThisPage of ThisSection"?

Hi Ed,

The code will only work if it's in the document header/footer. If you've got it working correctly in one document, then copying &
pasting it into another document should work correctly too.

For your landscape pages, you may need to put a text box into the header/footer, format it so that it is the height of the page but
only the width of the normal header, rotate the text 90 degrees and paste the field code into the text box.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"Ed from AZ" wrote in message ...
Okay - just tried it.

In the header of a new doc with two sections, it works great to
identify each page of each section as "First", "Last", or "Other".

In my report, though, it bombs! I can't get anything besides "Other
Page". I copied the code directly over - nothing changed in the
translation (I think)??

{QUOTE{IF{PAGE}= 1 {SET Section0 0}}{IF{PAGE}={NUMPAGES} "Last
Page" {IF{={SECTIONPAGES}+{REF {QUOTE Section{={SECTION}-1}}}}={PAGE}
"{SET {QUOTE Section{SECTION}} {PAGE}}Last Page" {IF{={PAGE}-{REF
{QUOTE Section{={SECTION}-1}}}}= 1 "First Page" "Other Page"}}}}

Any hints for troubleshooting why?

Ed


On Apr 2, 7:55 am, Ed from AZ wrote:
Hi, macropod.

No, I can't restart the page numbering - this is a landscape section
in the middle of a report that's holding a table that will flow over
several pages. I need to change the table header depending on which
page I'm on. Hence, the IF with the criteria dependent on the page of
that section.

Is there a way to copy and paste this field code into the Word doc and
replace the curlys with the CTRL+F9 brackets? Saves a lot of "it
won't work because I fumbled my typing" frustrations!! 8)

Thanks for the boost!
Ed

On Apr 2, 1:37 am, "macropod" wrote:



Hi Ed,


BTW, is there a reason you can't unlink each Section from the previous one and set the page numbering for each Section to start
from
1? Although it's perhaps more fiddly to maintain, you could then greatly simplify the field coding:
{IF{PAGE}= 1 "First Page" {IF{PAGE}= {SECTIONPAGES} "Last Page" "Other Page"}}


Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Ed from AZ Ed from AZ is offline
external usenet poster
 
Posts: 91
Default What field shows "ThisPage of ThisSection"?

Thanks for sticking with me. I'll work on it ans see what I can come
up with.

Ed


On Apr 2, 2:06*pm, "macropod" wrote:
Hi Ed,

The code will only work if it's in the document header/footer. If you've got it working correctly in one document, then copying &
pasting it into another document should work correctly too.

For your landscape pages, you may need to put a text box into the header/footer, format it so that it is the height of the page but
only the width of the normal header, rotate the text 90 degrees and paste the field code into the text box.

Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------

"Ed from AZ" wrote in ...
Okay - just tried it.

In the header of a new doc with two sections, it works great to
identify each page of each section as "First", "Last", or "Other".

In my report, though, it bombs! *I can't get anything besides "Other
Page". *I copied the code directly over - nothing changed in the
translation (I think)??

{QUOTE{IF{PAGE}= 1 {SET Section0 0}}{IF{PAGE}={NUMPAGES} "Last
Page" {IF{={SECTIONPAGES}+{REF {QUOTE Section{={SECTION}-1}}}}={PAGE}
"{SET {QUOTE Section{SECTION}} {PAGE}}Last Page" {IF{={PAGE}-{REF
{QUOTE Section{={SECTION}-1}}}}= 1 "First Page" "Other Page"}}}}

Any hints for troubleshooting why?

Ed

On Apr 2, 7:55 am, Ed from AZ wrote:



Hi, macropod.


No, I can't restart the page numbering - this is a landscape section
in the middle of a report that's holding a table that will flow over
several pages. I need to change the table header depending on which
page I'm on. Hence, the IF with the criteria dependent on the page of
that section.


Is there a way to copy and paste this field code into the Word doc and
replace the curlys with the CTRL+F9 brackets? Saves a lot of "it
won't work because I fumbled my typing" frustrations!! 8)


Thanks for the boost!
Ed


On Apr 2, 1:37 am, "macropod" wrote:


Hi Ed,


BTW, is there a reason you can't unlink each Section from the previous one and set the page numbering for each Section to start
from
1? Although it's perhaps more fiddly to maintain, you could then greatly simplify the field coding:
{IF{PAGE}= 1 "First Page" {IF{PAGE}= {SECTIONPAGES} "Last Page" "Other Page"}}


Cheers
--
macropod
[MVP - Microsoft Word]
-------------------------- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruler shows "ch" instead of "in" Not Options/language problem rpurosky Microsoft Word Help 1 May 24th 07 07:55 PM
how do I set up a "expand/collapse" or "show/hide" field in Word WordDoc_FeatureUser Microsoft Word Help 2 May 12th 07 06:29 PM
"Print current page" should have a "+n pages" field. rawahoho Microsoft Word Help 5 November 16th 06 03:26 PM
Word shows "save" and "save" in drop down menu- no "save as" JenniferK Microsoft Word Help 4 May 26th 06 06:21 PM
New field for Word: {SCREENTIP "DisplayText" "TipText"} DQC from Prescott AZ Microsoft Word Help 1 March 17th 06 11:29 PM


All times are GMT +1. The time now is 01:08 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"