![]() |
|
#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
|
|
|
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 |