#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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 |
#3
|
|||
|
|||
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 |
#4
|
|||
|
|||
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 |
#5
|
|||
|
|||
This is an Ole Automation from a c# app.
The section changes are in the document. |
#6
|
|||
|
|||
Can you provide more details? Just sayign this is ole automation from a c# app is a bit opaque.
|
#7
|
|||
|
|||
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 |
#8
|
|||
|
|||
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'. |
#9
|
|||
|
|||
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". |
#10
|
|||
|
|||
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? |
#11
|
|||
|
|||
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. |
#12
|
|||
|
|||
IN which case a sample document would be really helpful.
|
#13
|
|||
|
|||
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. |
#14
|
|||
|
|||
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. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Page-numbering question: continue numbering from one section to the next? {PAGE} of {SECTIONPAGES} | SDwriter | Word | 12 | 10-25-2017 06:56 AM |
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 |
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 |