Consulting

Results 1 to 3 of 3

Thread: How to Restart page numbering after 4 pages

  1. #1
    VBAX Regular
    Joined
    Jan 2021
    Posts
    9
    Location

    Post How to Restart page numbering after 4 pages

    VBA WORD, How to start page renumbering after 4 pages?
    Last edited by Aussiebear; 04-10-2024 at 08:01 PM. Reason: Converted to English

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,058
    Location
    Microsoft gives this as an example
    With ActiveDocument.Sections(1) 
        .Footers(wdHeaderFooterPrimary).PageNumbers.Add _ 
        PageNumberAlignment:=wdAlignPageNumberLeft, _ 
        FirstPage:=True 
    End With
    So what happens if we went with
    With ActiveDocument.Sections(5) 
        .Footers(wdHeaderFooterPrimary).PageNumbers.Add _ 
        PageNumberAlignment:=wdAlignPageNumberLeft, _ 
        FirstPage:=True
    End With
    Just guessing here, while we wait for those experts who are currently slumbering to come calling.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Contributor
    Joined
    Jul 2020
    Location
    Sun Prairie
    Posts
    123
    Location
    That adds page numbers, it does not restart the numbering sequence.
    Doing that requires a Section break before page 4.
    You need to know the Word object model for page numbering before you start trying to code it.
    Try creating a scratch document and record a macro that restarts the numbering using the Format Page Numbers dialog and look at the code.

    These talk about what is going on in Word.
    Numbering Front Matter by Suzanne Barnhill, MVP
    Page Numbers in Word 2007-2021 (365)

    Then look at your recorded code in the vba editor to get an idea of the Word objects and methods involved.
    How to Modify a Recorded Macro by Jay Freedman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •