Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page X of Y in MSWord 3

Status
Not open for further replies.

SandorC

MIS
Aug 26, 2001
39
BR
Hi Everyone!
I use the AutoText option ´Page X of Y´ in the document´s footer to number the pages.
When it is done at the end of the work, it is OK but I am using OLE from an other program to build the document (use a model and change the chapters).
If the number os the pages increases or decreases dynamically the ´Page X of Y´ keeps the initial value. There is a way to avoid this? (the ´Y´ on ´Page´ changes dynamically)
Regards.
Sandor
 
You need to repaginate to get the value to update.
 
If the document is going to be printed, make sure Tools, Options, Print, Update Fields is selected, and Word will update the page numbers when it prints.

Otherwise, you need to use code to open the footer, select all the text and update the fields. The code in Word VBA is as follows:

If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Or ActiveWindow.ActivePane.View.Type _
= wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
If Selection.HeaderFooter.IsHeader = True Then
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
Else
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
End If
Selection.WholeStory
Selection.Fields.Update
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top