|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0
Hi - I've searched various forums for the following, but can't find exactly what I need (or else can't recognize it if it exists). I have a document that with a section break at the end of each page that I need to have numbered continuously across all sections. I also need the numbering to start with '0.' Somewhere I found a macro that numbers the document continuously (shown below), but it starts with 1, not 0. Could anyone tell me what needs to be added or changed to have it start with 0? TIA!! (obviously, I do not know anything about VBA, other than to know it exists and can be magic ) Here's the existing code (which someone else wrote): 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.RestartNumberin gAtSection = False DoEvents Next sec With ActiveDocument.ActiveWindow.View .SeekView = wdSeekMainDocument End With Selection.HomeKey Done: Application.ScreenUpdating = True End Sub Thanks again. |
#2
|
||||
|
||||
Perhaps you better take a step back and ask yourself WHY you need a section break at the end of each page. It would be better to use a hard page break so you only have one section's header/footers to deal with.
If you want the first section in the document to start numbering from 0 then you should do that with Code:
With ActiveDocument.Sections(1).Headers(1).PageNumbers .NumberStyle = wdPageNumberStyleArabic .HeadingLevelForChapter = 0 .IncludeChapterNumber = False .ChapterPageSeparator = wdSeparatorHyphen .RestartNumberingAtSection = True .StartingNumber = 0 End With
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Hi mate,
Try Footnotes.NumberingRule Footnotes.NumberingRule property (Word) | Microsoft Docs Then do a basic loop through sections and restart numbering (I haven't tried it but I think that's what you need) Set myRange = ActiveDocument.Sections(1).Range If myRange.Footnotes.NumberingRule = wdRestartSection Then myRange.Footnotes.NumberingRule = wdRestartPage End If |
#4
|
|||
|
|||
Thanks
Thank you, Guessed. Unfortunately, that didn't work for me. Perhaps more information is needed:
Again, thanks for your help and taking the time to answer. If you or anyone else can assist further, I'd appreciate it! ukusprof |
#5
|
|||
|
|||
Quote:
Thanks for this. When I read about the rule, it seems to imply that it will restart numbering with each page/section. What I actually need is continuous numbering, but I need it to start with 0, not with 1. The code I'm currently using works brilliantly, except it starts with 1. Here's that code again. Is there something I can add to make it start with 0? Sub ContinuePageNumbers()Many thanks for your time! |
#6
|
|||
|
|||
Quote:
Also forgot to mention to you that this is a series of 1 pg login sheets generated from a merge document; hence the section breaks. Because the logins themselves are sequentially numbered, I want the page numbers to match, 0-15. (Or however many logins I'm generating for the particular course). Thanks! |
#7
|
|||
|
|||
Cross-posted at: Need help with simple (I hope) edit for continuous page numbering across sections
and answered at: Macro for continuous page numbering in 1 pg merge document starting - Microsoft Community For cross-posting etiquette, please read: A Message to Forum Cross-Posters Excelguru Help Site - A message to forum cross posters If there are other posts you've made in other forums, it is your responsibility to clean this up. |
#8
|
|||
|
|||
Sorry for cross posting!
I will clean this up. Thanks!
|
#9
|
||||
|
||||
Quote:
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#10
|
|||
|
|||
Sorry mate, I realise you were talking about footer numbering and I share a tip for footnote numbering, my bad.
Just check the PageNumbers object - PageNumbers object (Word) | Microsoft Docs And for numbering setting, check the properties under PageSetup, such as oddandeven, etc. - PageSetup.OddAndEvenPagesHeaderFooter property (Word) | Microsoft Docs |
#11
|
|||
|
|||
Thanks to everyone - I appreciate all the help! You guys rock!
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Page numbers not following. All sections continuous, link to previous selected. | ClaireP | Word | 4 | 07-07-2020 08:12 AM |
Starting Sections of a paper at the top of a new page | Lou_Reed | Word | 3 | 12-11-2018 01:55 PM |
begin each section with page 1 in header PLUS continuous page numbering in footer | onemorecupofcoffee | Word | 18 | 09-04-2013 04:31 PM |
Sections starting on even page | Eva | Word | 1 | 11-05-2011 01:20 PM |
Continuous page numbering in a merged document | dkeinath | Mail Merge | 0 | 07-30-2010 09:30 AM |