Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.pagelayout
Terry Aney Terry Aney is offline
external usenet poster
 
Posts: 2
Default Using InsertFile and getting Page Numbers to start at 1


Hi,

I am automating Word 2007 (have tried with VBA and C#) to append several
documents together. These documents can have different margins,
headers/footers, etc.

I have followed the procedure described by
http://word.mvps.org/faqs/Formatting...thSections.htm and am not getting
the desired output.

Given the following documents:

Document 1 - No headers, footers without page numbers

Document 2 - Different margins from Document 1, has no headers, but has
footers without page numbers.

Document 3 - Same margins as Document 2, has no headers, but has footers
*with* page numbers. The first section in this document is *not* linked to
previous section (or so Word says when I have this document opened in
isolation) and it has its page numbering set to restart at number 1.

I have a loop that essentially puts the continuous section breaks at the
beginning and end (setting size to 1 font size so 'not noticeable') in via
code 'simliar' to:

foreach document
call application.Selection.HomeKey(wdStory)
call application.Selection.InsertBreak(wdSectionBreakCo ntinuous)
call application.Selection.Document.Sections(1).Range.S elect
application.Selection.Font.Size = 1

call application.Selection.EndKey(wdStory)
call application.Selection.InsertBreak(wdSectionBreakCo ntinuous)
call application.Selection.Document.Sections(
application.Selection.Document.Sections.Count-1
).Range.Characters.Last.Select
application.Selection.Font.Size = 1

Then assuming I've opened Document 1, I have the following code to merge the
three documents:

call application.Selection.EndKey(wdStory)
call application.Selection.InsertBreak(wdSectionBreakNe xtPage)
call application.Selection.InsertFile("Document 2")
call application.Selection.EndKey(wdStory)
call application.Selection.InsertBreak(wdSectionBreakNe xtPage)
call application.Selection.InsertFile("Document 3")

Everything (i.e. margins, headers and footers) looks pretty good except for
the problem that the *first page* of 'Document 3' has a page number equal to
the actual page that the page corresponds to in *entire* merge (i.e. page 13
say), then the *second page* of 'Document 3' starts over at page number 2 and
continues on.

When I examine the page numbering restart properties on the first page of
'Document 3' (after the merge) the property has changed to 'Continue from
previous section'.

If anyone has any suggestions I would greatly appreciate it.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
page numbers start over Erin Microsoft Word Help 4 April 24th 23 08:50 PM
Using InsertFile and getting Page Numbers to start at 1 Terry Aney Page Layout 2 February 25th 10 08:33 PM
how do I start page numbers with 5th page numbered page 1? billyboy Page Layout 2 November 8th 09 04:46 PM
start page numbers at 1 chuckmg Microsoft Word Help 2 May 27th 09 04:06 AM
page numbers start over [email protected] Microsoft Word Help 2 January 18th 08 01:22 AM


All times are GMT +1. The time now is 09:09 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"