Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2007

Tip: Looking for answers? Try searching our database.

wdHeaderFooterFirstPage, wdHeaderFooterPrimary or wdHeaderFooterEvenPages

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Senad Isanovic - 28 May 2007 09:00 GMT
How do I loop through all sections in the doc and set range variable to
footer range wdHeaderFooterFirstPage, wdHeaderFooterPrimary, or
wdHeaderFooterEvenPages. I also need to know that exactly is the difference
between those three constants

   If ActiveDocument.Sections.PageSetup.DifferentFirstPageHeaderFooter Then

       Set rgeFooter =
sSec1.Footers(wdHeaderFooterFirstPage).Range.Paragraphs(1).Range

   Else

       Set rgeFooter =
sSec1.Footers(wdHeaderFooterPrimary).Range.Paragraphs(1).Range

   End If
Doug Robbins - Word MVP - 28 May 2007 09:44 GMT
Each Section of a document can have three Headers and three Footers.

1    The First Page Header/Footer is the one that will appear on the first
page of the document if in Page Layout (or programmatically) the Section is
set up to have a Different First Page

2    The Primary Header/Footer is the one that will appear:

(a)    On all pages if the Section is not set to have a Different First Page
or Different Odd and Even

(b)    On the other pages if the Section is set to have a Different First
Page and it is not set to have Different Odd and Even

(c)    On the other Odd pages if the Section is set to have a Different
First Page and to have Different Odd and Even

3    The Even Header/Footer will appear on the Even pages of a section that
is set to have Different Odd and Even.

To do something with the .Range of all of the possible headers and footers
in all of the sections of a document, you would need to use:

Dim i As Long
Dim myrange As Range
With ActiveDocument
   For i = 1 To .Sections.Count
       With .Sections(i)
           Set myrange = .Headers(wdHeaderFooterFirstPage).Range
           'do something with myrange
           Set myrange = .Footers(wdHeaderFooterFirstPage).Range
           'do something with myrange
           Set myrange = .Headers(wdHeaderFooterPrimary).Range
           'do something with myrange
           Set myrange = .Footers(wdHeaderFooterPrimary).Range
           'do something with myrange
           Set myrange = .Headers(wdHeaderFooterEvenPages).Range
           'do something with myrange
           Set myrange = .Footers(wdHeaderFooterEvenPages).Range
           'do something with myrange
       End With
   Next i
End With

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> How do I loop through all sections in the doc and set range variable to
> footer range wdHeaderFooterFirstPage, wdHeaderFooterPrimary, or
[quoted text clipped - 13 lines]
>
>    End If
edwinf - 26 Jul 2007 04:38 GMT
Mr. Doug Robbins,
     I am also new to this programming. I have some details to know
regarding your reply...Where in the part will i put the codes you gave? And
could you please give me a sample on what to put after you set "myrange"
value? Like,

Set myrange = .Headers(wdHeaderFooterFirstPage).Range
'do something with myrange  <--- on this part?

     Because i have this problem on how to put a certain fix table for
every page (with page 1 differ from the next pages)... You can see my Post
titled "How to loop a certain header with a certain condition"
     I've titled this as header bec. i can't figured out where to put that
looping table.
     Please let me have your help...
     Thanks in advance....

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.