You are still using the Selection object. STOP.
Follow through section by section.
I do not know if have made the changes I suggested, but think this one through.
You have your first page...nothing else.
do your pagesetup (margins , whatever) for that section, the cover page.
Make a new section (this is for your ToC). If they are different from the cover page section, fine, do another pagesetup, and have it apply to THIS SECTION. If they are NOT different from the coverpage section - forget about it.
Remember this is happening BEFORE any files are being copied in. Please stop refering to them being inserted in - they are not being inserted, they are being copied (that is if you changed your code to what I wrote).
Then you make a new section. This is the starting section (#3 now) for your content you are copying in. Do another pagesetup. This time make it to apply from
This Section Forward. If you want to add the filename of the source file that is filling the content of each content section, then add SFile in the footer.
This is also where you START your page numbering. On this first section (but #3 in the collection), I think you want to start page numbering at 1. So, go Page Numbering, Section, start from 1. Do know know how to do that?
Please look up Help on the Selection object, or if you want, I have some documentation for a VBA course I am writing regarding the Selection object. I could send it to you. For example:
Currently I have this code to change the margin of the entire doc.
With ActiveDocument.Range(Start:=Selection.Start, End:=ActiveDocument. _
Content.End).PageSetup
.LeftMargin = CentimetersToPoints(1.3)
End With[/code}
This is absolutely incorrect. It will NOT, repeat, NOT change the entire document. Well it would but ONLY, repeat ONLY, if the selection point is at the very first character of the document. Look at the code. The range being affected is Range(Start:=Selection.Start,.
It will afect from the selection point to the end of the document. If the selection point is on page 12 of a 13 page document....the only thing affected is from, well the selection point to the end of the document. ie. page 12 and 13.
You got that from my code. Read it again. That code ran, right after the first section break was inserted, after the cover page. I did not want to assume that the margins were the same for the cover page. Cover pages are tricky, and usually have their own page setup. So I ran that to affect margins, from that point onwards. If you run it with the ToC routine, then it will afect the ToC section.
With ActiveDocument
.PageSetup.LeftMargin blah blah
.bla blah
End With
DOES affect the whole ActiveDocument.
With ActiveDocument
.Range(Start:=Selection.Start, _
End:=ActiveDocument. _
Content.End)
.PageSetup.LeftMargin blah blah
.bkah blah
End With
affects everything from the selection point to the end of the document. And the selection point at the time you seem to be running this code is NOT at the beginning of the document, or even at the beginning of the section you want to apply this to.
Gerry