Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-16-2014, 05:02 PM
gmaxey gmaxey is offline What's wrong with my loop? Windows 7 32bit What's wrong with my loop? Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
First 5 slides in a loop Joop PowerPoint 0 05-06-2014 09:30 AM
What's wrong with my loop? End or alter a loop? DJSOUND Word VBA 1 10-11-2013 08:11 PM
What's wrong with my loop? How to a For loop in VBA Jennifer Murphy Word VBA 1 01-29-2013 03:30 AM
While loop not working right Cbrehm Excel Programming 0 05-11-2011 11:05 AM
What's wrong with my loop? Continuous Loop cksm4 Word 6 01-06-2011 09:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:36 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft