Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-13-2021, 03:01 PM
ukusprof ukusprof is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Mac OS X Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2016 for Mac
Novice
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0
 
Join Date: Sep 2021
Posts: 6
ukusprof is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 09-13-2021, 08:51 PM
Guessed's Avatar
Guessed Guessed is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Windows 10 Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,573
Guessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to behold
Default

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
Reply With Quote
  #3  
Old 09-14-2021, 08:42 AM
TheBigBoss TheBigBoss is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Windows 7 32bit Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2010 32bit
Novice
 
Join Date: Dec 2016
Posts: 18
TheBigBoss is on a distinguished road
Default

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
Reply With Quote
  #4  
Old 09-14-2021, 08:48 AM
ukusprof ukusprof is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Mac OS X Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2016 for Mac
Novice
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0
 
Join Date: Sep 2021
Posts: 6
ukusprof is on a distinguished road
Default Thanks

Thank you, Guessed. Unfortunately, that didn't work for me. Perhaps more information is needed:
  1. The document in question is a series of sequential 1-pg login sheets, generated through a merge action. I need to apply the macro to the generated document. Without it, all footers say "Classroom Information Sheet #1". There is more info in the footer, but the page number field is what I need to address.
  2. Though I'm not a VBA expert, I am proficient in Word, so please don't make the assumption that I don't know when I need to use section breaks vs page breaks.
  3. In the code you provided, wouldn't the "restart numbering at section" line need to be false for continuous numbering across sections? Also, I don't need any separator hyphens or other formatting; the merge document contains all the formatting required. Again, I don't know VBA, but that's what your code seems to include.

Again, thanks for your help and taking the time to answer. If you or anyone else can assist further, I'd appreciate it!

ukusprof
Reply With Quote
  #5  
Old 09-14-2021, 08:56 AM
ukusprof ukusprof is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Mac OS X Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2016 for Mac
Novice
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0
 
Join Date: Sep 2021
Posts: 6
ukusprof is on a distinguished road
Default

Quote:
Originally Posted by TheBigBoss View Post
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
Hi, TheBigBoss-

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()

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
.StartingNumber = 0
DoEvents
Next sec

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

Done:
Application.ScreenUpdating = True
End Sub
Many thanks for your time!
Reply With Quote
  #6  
Old 09-14-2021, 09:01 AM
ukusprof ukusprof is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Mac OS X Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2016 for Mac
Novice
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0
 
Join Date: Sep 2021
Posts: 6
ukusprof is on a distinguished road
Default

Quote:
Originally Posted by TheBigBoss View Post
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
TheBigBoss -

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!
Reply With Quote
  #7  
Old 09-14-2021, 12:51 PM
Charles Kenyon Charles Kenyon is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Windows 10 Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 7,512
Charles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud ofCharles Kenyon has much to be proud of
Default

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.
Reply With Quote
  #8  
Old 09-14-2021, 01:02 PM
ukusprof ukusprof is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Mac OS X Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2016 for Mac
Novice
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0
 
Join Date: Sep 2021
Posts: 6
ukusprof is on a distinguished road
Default Sorry for cross posting!

I will clean this up. Thanks!
Reply With Quote
  #9  
Old 09-14-2021, 10:15 PM
Guessed's Avatar
Guessed Guessed is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Windows 10 Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 2,573
Guessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to beholdGuessed is a splendid one to behold
Default

Quote:
Originally Posted by ukusprof View Post
In the code you provided, wouldn't the "restart numbering at section" line need to be false for continuous numbering across sections? Also, I don't need any separator hyphens or other formatting; the merge document contains all the formatting required. Again, I don't know VBA, but that's what your code seems to include.
My code is setting up the formatting for Section 1 only. There is no preceding section so the restart setting is irrelevant to that code but I left that and the other settings in there so you could refer to it and tweak if required. The code you provided in your original post was lacking in these auxiliary settings and depending on your initial document, some of them may have be required in the loop you are running.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #10  
Old 09-14-2021, 10:45 PM
TheBigBoss TheBigBoss is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Windows 7 32bit Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2010 32bit
Novice
 
Join Date: Dec 2016
Posts: 18
TheBigBoss is on a distinguished road
Default

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
Reply With Quote
  #11  
Old 09-15-2021, 09:03 AM
ukusprof ukusprof is offline Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Mac OS X Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 Office 2016 for Mac
Novice
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0
 
Join Date: Sep 2021
Posts: 6
ukusprof is on a distinguished road
Default

Thanks to everyone - I appreciate all the help! You guys rock!
Reply With Quote
Reply

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
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 begin each section with page 1 in header PLUS continuous page numbering in footer onemorecupofcoffee Word 18 09-04-2013 04:31 PM
Need help with simple (I hope) edit for continuous page numbering across sections, starting with 0 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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:20 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft