AFAIK if header/footer contains 'page X of Y' expression created manually from Word, then number of pages Y may not displayed correctly in the Page Layout View. However it is displayed correctly in the Print Preview.
You can get the actual page number using:
?oWord.Activedocument.ComputeStatistics(2)
and replace header/footer as needed or as soon as you add pages to the word document in the code.
>All,
>
> I have an application that opens a word document and fills in some fields. The users can either preview the document with Word, or Print the document which prints the document using Word automation. When the user selects the print option the page numbers in the footer say X of 12 and there are only 9 pages, not 12. Has anyone come across this before or know how to fix it? The code I use for printing is below
>
>
>PROCEDURE PrintWordDoc
> LPARAMETERS oWord
> LOCAL lBackground
> WITH OWord
> lBackGround = .Options.PrintBackground()
> IF lBackGround
> .Options.PrintBackGround = .F.
> ENDIF
> .Wordbasic.FilePrintDefault
> IF lBackGround
> .Options.Printbackground = !.Options.PrintBackGround
> ENDIF
> ENDWITH
>