View Single Post
 
Old 06-16-2014, 05:02 PM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

There is nothing wrong with your loop as it is doing exactly what you are telling it to do.

Word headers and footers are sort of like the old player piano sheets that form a continuous loop that repeats over an over again. Unless you break the link between new sections when you add them the contents will just keep piling up. Unless broken the first section header is sort of linked to the last section header.

Code:
Sub AddFooter()
Dim i As Integer
ActiveDocument.PageSetup.OddAndEvenPagesHeaderFooter = True
For i = 1 To ActiveDocument.Sections.Count
  ActiveDocument.Sections(i).Footers(wdHeaderFooterPrimary).LinkToPrevious = False
  ActiveDocument.Sections(i).Footers(wdHeaderFooterPrimary).Range.InsertAfter "Odd Footer Section " & i
  ActiveDocument.Sections(i).Footers(wdHeaderFooterEvenPages).LinkToPrevious = False
  ActiveDocument.Sections(i).Footers(wdHeaderFooterEvenPages).Range.InsertAfter "Even Footer Section " & i
Next i
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote