Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Numbering / March 2008

Tip: Looking for answers? Try searching our database.

Page X of Y where Y does not equal Numpages nor SectionPages

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sally Green - 12 Mar 2008 03:29 GMT
Hi

I'm using Word 2003 and have a template for a large document.  At template
stage there is a cover page (actual page 1), a second cover page (actual page
2), a TOC (actual page 3) all in Section 1.  No page numbering is required on
these pages.  Currently the actual fourth page is the start of Section 2 and
page numbering commences at Page 1 on this page.  Depending on the length of
the finished document the TOC could run over into a second, third or even
fourth page.  In that scenario the first page of section 1 (numbered as 1)
might possibly be the 5th, 6th, or even 7th actual page in the document.

So if I end up with 14 pages in the document with only 3 pages in section 1
my last page should read Page 11 of 11 (Scenario 1).  Or if I had 2 TOC
pages, so therefore had 4 pages in section 1, my last page should read Page
10 of 10 (Scenario 2).

So assuming Scenario 1:
With using Page of Numpages I would get Page 11 of 14
With using Page of SectionPages I might get Page 11 of 11 providing they
don't insert a section break mid-way (some of these documents can get to over
a hundred pages) with appendices in landscape so a section break would be
required.
I can't set a bookmark on the last page in the template so that I can use
Page of PageRef BookmarkName as I can't rely on that bookmark staying there
for the duration of the document creation.  I've created a module to go to
the end of the document, create the bookmark, so that I can then use PageRef.
However, they could only run this after the doucment has been created and
they may edit it afterwards and not run the module again.  I really would
like a field that can automatically update without having to rely on human
error.

I can create a bookmark after the TOC that will move down with the TOC to
give me the overall number of pages in section 1.  Can I create a formula to
subtract this number from NumPages.  ie:
Page {Page} of ({NumPages}-{PageRef bmLastPageNoInTOC})
This example only returns:
PAGE 11 OF (14-3)

Any suggestions would be greatly appreciated.
Sally Green - 12 Mar 2008 03:51 GMT
This code returns the correct page number of the last numbered page but I
don't know how to get it into the footer of the template.  I tried to create
a Function (instead of a Sub) as I would in Excel but didn't have any success
with that.

Sub Pages()
   Dim lngLastPageNoInTOC, lngTotalNoOfPages As Long
   ActiveDocument.Bookmarks("bmLastPageNoInTOC").Select
   lngLastPageNoInTOC = Selection.Information(wdActiveEndPageNumber)
   
   lngTotalNoOfPages = Selection.Information(wdNumberOfPagesInDocument)
       
   lngTotalNoOfPages = lngTotalNoOfPages - lngLastPageNoInTOC
End Sub

Cheers
Sally

> Hi
>
[quoted text clipped - 35 lines]
>
> Any suggestions would be greatly appreciated.
Sally Green - 12 Mar 2008 05:48 GMT
Solution, thanks to Suzanne from an earlier posted question, gave me the idea
of putting my formula inside another field bracket set.  So the solution is
(I'm typing the brackets here but you'll get the general idea):

Page {PAGE} of {={NUMPAGES}-{PAGEREF bmLastPageNoInTOC}}

My bookmark is called bmLastPageNoInTOC and is positioned directly after the
TOC on Page 3 in the template.  As the TOC is updated and may go to several
pages the bookmark will always appear after the TOC, so PAGEREF will pick up
the actual page number of the last page in the TOC.

Many thanks.  A good trick to learn.

Sally

> Hi
>
[quoted text clipped - 35 lines]
>
> Any suggestions would be greatly appreciated.
Doug Robbins - Word MVP - 12 Mar 2008 11:10 GMT
Or you could use a DOCVARIABLE field in the footer and set the value of the
variable using your code.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Solution, thanks to Suzanne from an earlier posted question, gave me the
> idea
[quoted text clipped - 70 lines]
>>
>> Any suggestions would be greatly appreciated.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.