PDA

View Full Version : Need help with simple (I hope) edit for continuous page numbering across sections



ukusprof
09-14-2021, 12:05 PM
Hi-

I need some assistance. I have a 1 pg merge document - log in sheets- that contains a footer with the page number. There are 15 or so individual pages in the generated document that require sequential page numbers. A while ago I managed to grab some code from somewhere (sorry I don't remember where!) that generates the page numbers in the footer, but it starts at 1 and I need it to start at 0. Otherwise, the code works exactly as I need it to.

Can anyone tell me how/where to add the instruction to start numbering at 0? Here's the current code:

Sub ContinuePageNumbers()


Dim sec As Section




On Error GoTo Done
Application.ScreenUpdating = False


With ActiveDocument.ActiveWindow.View
.SeekView = wdSeekPrimaryFooter
End With


For Each sec In ActiveDocument.Sections
sec.Footers(wdHeaderFooterPrimary).Range.Select
Selection.HeaderFooter.PageNumbers.RestartNumberingAtSection = False
DoEvents
Next sec


With ActiveDocument.ActiveWindow.View
.SeekView = wdSeekMainDocument
End With
Selection.HomeKey


Done:
Application.ScreenUpdating = True
End Sub


Thanks in advance for any help!

Chas Kenyon
09-14-2021, 12:45 PM
Cross-posted and answered in Microsoft Community at https://answers.microsoft.com/en-us/msoffice/forum/all/macro-for-continuous-page-numbering-in-1-pg-merge/81ced61e-1020-4c06-8442-18b22940c4d4.

Also cross-posted at https://www.msofficeforums.com/word-vba/47635-need-help-simple-i-hope-edit-continuous.html

For cross-posting etiquette, please read: A Message to Forum Cross-Posters (https://www.excelguru.ca/content.php?184) https://www.excelguru.ca/content.php?184
If you have posted in more, it is your responsibility to follow up.