PDA

View Full Version : Solved: NumPages and SectionPages Clarification



GetSmart
09-29-2005, 11:01 AM
:banghead: I have asked this question in other forums, but the answers received from several MVP's are not getting it! I have looked for a solution to my problem for several days and my eyes are crossed from all the reading!

THE SCENARIO: I have a protected form template that, upon opening, contains only 2 pages.

Page 1 is a Summary which will grow into multiple pages, followed by a Report page which will grow into multiple pages.

The Summary pages are numbered Summary Page 1 of X. (I know, I know, numpages problemos) The Report pages will be numbered Page 1 of X (Again same ole, same ole!)

There are 2 section breaks on the first page.
(Section 1) a Section Break - Continuous, to create the protected section at the top for form fields and another, below, (Section 2) a Section Break - Next Page, to create an unprotected section for the user as well as the first page of the Report section. The Header/footer on this page is: First Page Header - Section 1 and First Page Footer - Section 1.

When a page is created between pages 1 and 2 (by oversetting), it is (Section 2) and that "new" page has as its Header/footer: Header - Section 2 and Footer - Section 2. The header/footer verbiage is the same as on the first page header/footer.

The second (original) page (section 3) The Header/footer on this page is: First Page Header - Section 3 and First Page Footer - Section 3. The header/footer verbiage is different from page 1 and any pages created off page 1 (sections 1 and 2).

I have read thru numerous threads to "bookmark the last page in the document" BUT - There ARE NO LAST PAGES in the document as they are yet to be! For the user, only first pages! :banghead: I am using SectionPages for the section 2 and section 3 header/footers and they are working just fine. The problem is the first page. Even though there are 2 section breaks physically on the page, the footer for this page, is and always will be, section 1 though overall the total number of pages is encompassed by all pages in section 2 as well as the first page.

:dunno Is there a way to modify, other than thru bookmarks, numpages or sectionpages to have the code account for the number of pages created in section 2 and reflect it on page 1? Like numpages + sectionpages s2 or something?????

Can someone please help as I'm stumped and really, really need to get this document out of my hands and into my users hands. Best regards

MOS MASTER
09-29-2005, 02:32 PM
Hi, :hi:

A lot of text here. :rofl:

No really this sort of thing needs an example. Could you post a example and tell us what to do to duplicate the problem? (And don't forget to tell what you want to happen instead)

You can attach a zipped document to the thread. :whistle:

GetSmart
09-29-2005, 03:28 PM
Have attached my word .dot, protection is on (toggle off) you can turn on Show/Hide to see breaks.

What's not working....page 1 pagination should increment as additional pages are added (thru oversetting, not thru forced breaks) between pg 1 and pg 2. It continues to reflect 1 of 1 (I understand why, just don't know how to bend it to my will...) new pages increment properly in newly created section 2 and section 3. That's why I wanted to know whether numpages or sectionpages could be modified.....

Your interest is appreciated.

TonyJollans
09-30-2005, 06:18 AM
Hi GetSmart,

Welcome to VBAX!

This is a bit of fun. Here is one way to do it - it's a little bit awkward to set up but it does work.

In the Template, ...
Create a second page of Summary
Edit the Section 2 Header
Unlink it from Section 1
Press Alt+F9 to view field codes
Add a field at the start of it ...
Press Ctrl+F9 to get a new field
Type SET SEC2PAGES
Press Ctrl+F9 again to get another field inside the first one
Type SECTIONPAGESNow go and edit the first section footer
Change SECTIONPAGES to SEC2PAGES
Press Alt+F9 to hide field codes
Close Header/Footer editing
Delete the page you created.

Now you need to initialise SEC2PAGES to 1 (because it is set to 2 as there were two pages (of necessity) when you set it up.

Somewhere in the body of the summary ..
Press Alt+F9 to view field codes
Press Ctrl+F9 to get a new field
Type SET SEC2PAGES 1
Select the complete field
Press F9 to update fields
Delete the field you just entered
Press Alt+F9 to hide field codes

Now go back and edit the first section footer
Press Ctrl+A to select all
Press F9 to update fileds
Close the Footer Edit

The document should now be set up - I hope I've given you all that you need (if not too much) - so close the template.

Now when you base a document on the template and the summary runs into a second page the SEC2PAGES value will update but ...

The reference to it in the first page footer won't update automatically.
However fields in headers and footers automatically update when printed (regardless of the print option to update fields) so it should always print the correct value.

GetSmart
09-30-2005, 11:13 AM
Tony:
Many, many thanks...your instructions were great! Everything worked up until the very last..:dunno

Followed your instructions....Initializing sequence as described produced error in page 1 footer "Error! Bookmark not defined". Funny, I added a number of pages and then deleted them one by one. The page 1 code did reflect the change downward in number of pages in the section as I removed them, until I got back down to the original 2 pages of the document. Without the initialization sequence, result on page 1 is 1 of 2. With initialization - result is error bookmark message. Understand about the code not updating, but nothing changed on-screen or in printing.

Code on my page 1 footer reads:
Summary Page { PAGE } of { SEC2PAGES.\*Arabic \* MERGEFORMAT. }

Code on page 2 footer:

Summary Page { PAGE } of { SET SEC2PAGES { SECTIONPAGES } }{SECTIONPAGES \* MERGEFORMAT. }

Are the spaces critical in the code?

.....name should be confused instead of getsmart

TonyJollans
09-30-2005, 11:53 AM
Hi GetSmart,

Hang around here for a while - we'll try and make you smart :)

You shouldn't have changed Page 2 Footer at all - I said Header (but Footer would have been alright, too). As I write that I realise my instructions may not have been perfect.

Section 1 Footer (on Page 1 of the document) should be as you have it now.

Section 2 Footer (only visible if you have added a second page to the summary) should be as it was before (that is "PAGE of SECTIONPAGES"). Now I've just checked my copy of your file and it says "Same As Previous" - that is because you have Different First Page set in Section 1 and it is only the first page footer that you have changed.

I will make a clean copy and post it - might be a little while though as I have to be separated from my PC for family duty.

No, the spaces don't matter at all.

TonyJollans
09-30-2005, 02:14 PM
Hi GetSmart,

OK, here it is.

Apart from initialisibng the variable, I have unlinked the Section 2 Header and changed the Section 2 Header and the Section 1 (First Page) Footer. That's it.

GetSmart
09-30-2005, 03:46 PM
Tony: It works!

A caveat: Adding the initialization field to reset the first page to 1 of 1..
I had to leave the field in section 2 in order to update the code in the page 1 footer. If I deleted it as in the instructions, I ended up with an Error! Missing Bookmark when I updated the footer....

Again my thanks... Life is change. Growth is optional. I try to choose wisely.

MOS MASTER
09-30-2005, 03:51 PM
Again my thanks... Life is change. Growth is optional. I try to choose wisely.

Nice and wise words! :yes

Glad to see you've found your solution and thanx for marking it solved. :whistle: