Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2018, 08:32 AM
texMan texMan is offline numbering after section change Windows 10 numbering after section change Office 2016
Novice
numbering after section change
 
Join Date: Nov 2017
Posts: 12
texMan is on a distinguished road
Default numbering after section change

Hi,

how can I reset the numbering to "1" after a section change.

I'm inserting 3 Word documents with a section change into an existing document.
I'm doing this with insertFile()
Everytime after a section change I want the numbering to be reseted to 1.

1. AAAAA
2.BBBBBBBBB
---------------
1. WWWW
2. KKKKKKKKK
--------------
1. VVVVVV
2. MMMMMM
...

Any Idea?

Juergen
Reply With Quote
  #2  
Old 01-09-2018, 01:35 PM
slaycock slaycock is offline numbering after section change Windows 7 64bit numbering after section change Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

It would be helpful if you posted code to show where you are at but as a pointer

Code:
    With Selection.HeaderFooter.PageNumbers
        .NumberStyle = wdPageNumberStyleArabic
        .HeadingLevelForChapter = 0
        .IncludeChapterNumber = False
        .ChapterPageSeparator = wdSeparatorHyphen
        .RestartNumberingAtSection = True
        .StartingNumber = 1
    End With
Reply With Quote
  #3  
Old 01-10-2018, 01:44 AM
texMan texMan is offline numbering after section change Windows 10 numbering after section change Office 2016
Novice
numbering after section change
 
Join Date: Nov 2017
Posts: 12
texMan is on a distinguished road
Default

This is the only VBA Code:

Selection.InsertFile FileName:="test.docx", Range:="", ConfirmConversions _
:=True, Link:=False, Attachment:=False

Selection.InsertFile FileName:="test2.docx", Range:="", ConfirmConversions _
:=True, Link:=False, Attachment:=False

Selection.InsertFile FileName:="test3.docx", Range:="", ConfirmConversions _
:=True, Link:=False, Attachment:=False
Reply With Quote
  #4  
Old 01-10-2018, 09:45 AM
slaycock slaycock is offline numbering after section change Windows 7 64bit numbering after section change Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

There must be more code that that because what you supplied won't run on its own.

You also need to be a little clearer regarding where the section breaks are located.

Do you insert a section break before you insert a document?

When you insert text from another document the cursor ends up at the end of the inserted text so if you want to set page numbering of the section at the start of the inserted text to 1 you will need to save the location of the cursor before you insert the file. You may also find that you don't actually get page 1 where you think it should go if the text before the section break is too long.

The code below demonstrates how to change the page number of the section where the file is inserted to 1(ish - due to the caveats above).

If the file starts with a section break then the code below will need to be modified to move the insertion point into the first section of the inserted text.

Code:
Sub test()
Dim insertion_point_before_insertion As Word.range

    Set insertion_point_before_insertion = Selection.range.Duplicate
    Selection.InsertFile FileName:="test.docx", range:="", ConfirmConversions:=True, Link:=False, Attachment:=False
    
    insertion_point_before_insertion.Select
    With Selection.HeaderFooter.PageNumbers
        .StartingNumber = 1
        .RestartNumberingAtSection = True
    End With

End Sub
Reply With Quote
  #5  
Old 01-10-2018, 10:57 AM
texMan texMan is offline numbering after section change Windows 10 numbering after section change Office 2016
Novice
numbering after section change
 
Join Date: Nov 2017
Posts: 12
texMan is on a distinguished road
Default

This is an Ole Automation from a c# app.
The section changes are in the document.
Reply With Quote
  #6  
Old 01-11-2018, 01:06 AM
slaycock slaycock is offline numbering after section change Windows 7 64bit numbering after section change Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

Can you provide more details? Just sayign this is ole automation from a c# app is a bit opaque.
Reply With Quote
  #7  
Old 01-11-2018, 01:21 AM
texMan texMan is offline numbering after section change Windows 10 numbering after section change Office 2016
Novice
numbering after section change
 
Join Date: Nov 2017
Posts: 12
texMan is on a distinguished road
Default

Everytime wenn there is a section change in the document I want to start the numbering with 1. Normally the numbering ist continuing.

1. AAAAA
1.1. BBBBB
2. CCCCC
------ Section change ------
1. DDDDDDD
1.1. EEEEEEEE
1.2 FFFFFFF
------ Section change ------
1. GGGGGGDDDDDDD
2. HHHHHHHHHHHH
3. KKKKKKKKKKKKKKK
Reply With Quote
  #8  
Old 01-11-2018, 01:35 AM
slaycock slaycock is offline numbering after section change Windows 7 64bit numbering after section change Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

So its not page numbering but the section numbering you wish to change. Apologies for my misunderstanding.

You can do this manually by right clicking on the section number and selecting 'restart at 1'.
Reply With Quote
  #9  
Old 01-11-2018, 01:53 AM
texMan texMan is offline numbering after section change Windows 10 numbering after section change Office 2016
Novice
numbering after section change
 
Join Date: Nov 2017
Posts: 12
texMan is on a distinguished road
Default

This exactly do not work!
When I insert a document with numbering in an existing document after a section change the numering continues. Also when I set the restart numbering with "1".
Reply With Quote
  #10  
Old 01-11-2018, 04:03 AM
slaycock slaycock is offline numbering after section change Windows 7 64bit numbering after section change Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

You can only restart automatic numbering. You can check if the numbering is automatic by right clicking on it. If the background does not go grey then it is not an automatic number and you will have to manually edit the numbering.

Can you post or send by PM an example document?
Reply With Quote
  #11  
Old 01-11-2018, 04:24 AM
texMan texMan is offline numbering after section change Windows 10 numbering after section change Office 2016
Novice
numbering after section change
 
Join Date: Nov 2017
Posts: 12
texMan is on a distinguished road
Default

It is grey. Also with left click.
The wrong numbering after section change is a known problem. You can google for it.

Now I try to use the LISTNUM Field functions.
Reply With Quote
  #12  
Old 01-11-2018, 05:03 AM
slaycock slaycock is offline numbering after section change Windows 7 64bit numbering after section change Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

IN which case a sample document would be really helpful.
Reply With Quote
  #13  
Old 01-11-2018, 08:58 AM
texMan texMan is offline numbering after section change Windows 10 numbering after section change Office 2016
Novice
numbering after section change
 
Join Date: Nov 2017
Posts: 12
texMan is on a distinguished road
Default

A sample document makes no sense. Because the problems arises by generating (inserting documents with c#) the document. Nobody wants change manually the numbering.

The document contains sections changes and wrong numbering.
Reply With Quote
  #14  
Old 01-11-2018, 10:34 AM
slaycock slaycock is offline numbering after section change Windows 7 64bit numbering after section change Office 2016
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

You have posted about a problem in the Word VBA forum so the assumption is that you are seeking a VBA solution. The information you've provided is limited. A sample document would allow the exact problem you are experiencing to be examined and if possible a VBA solution proposed.

Your decision.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
numbering after section change Page-numbering question: continue numbering from one section to the next? {PAGE} of {SECTIONPAGES} SDwriter Word 12 10-25-2017 06:56 AM
numbering after section change Section numbering screwed up scorpio_oz Word 7 04-06-2016 06:02 AM
Why does Word indexing change section page numbering to "continuous"? kaspencer Word 6 07-02-2015 02:24 PM
numbering after section change Help with Section Numbering in Table of Contents Virtualkat Word 1 10-03-2012 07:10 AM
Heading numbering and section breaks uby Word 2 11-22-2010 10:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:38 AM.


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