View Single Post
  #1  
Old June 2nd, 2004, 07:46 AM
Ganeth
external usenet poster
 
Posts: n/a
Default Incorrect {PAGE} fields in document compiled with VBA from others docs

The situation:
Having successfully compiled (using VBA) a large document from 100+ smaller documents, I'm now faced with a page numbering problem. Although the page number in the 'status' bar at the bottom of Word gives the correct page number, a {PAGE} field inserted into the footer of each page gives an incorrect value - out of 220 pages, it reads page 1 to 82 of 220 ( Page 1 of 220, Page 2 of 220 etc), then Page 1 to 4 of 220, then Page 1 to 4 of 220, etc, until the last 'group' reads Page 1 to 58 of 220 - v. weird as these numbers do not tally up with the number of pages in the inserted files, which are mostly just two page files.

I have already tried:
1) Programmatically numbering these pages by looping through each page and writing manual values to the footers - this does not work due to the fact that the section breaks often display the same page number twice.
2) Programmatically going to each footer, deleting the incorrect values, doing an activedocument.repaginate, adding a {PAGE} field, then doing activedocument.repaginate again.

In addition to all of the above, this actually worked at one point in the past without any programmatic adjustments after generating the document from the source documents. This problem has cropped up after I tried to speed up execution by using word.application.visible = true. I removed the code for hiding the application, but the problem still remained even after this. There is unique information beside the page number in each section footer, so I can't just redo all the sections.

Any suggestions would be most welcome.

Many thanks,

Ganeth