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 / March 2008

Tip: Looking for answers? Try searching our database.

Select each page ina documet and then change the header

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cutecoder - 14 Mar 2008 14:04 GMT
Hi ,

I am trying to write a macro to insert/replace header and footer in a
document. In which goto do the following

step1: Select the page (in for loop)
step2: Check for multiple section of header and footer
step3: Replace/insert header and footer

could anyone please tell me how to select pages in sequence order?

Thank you
Doug Robbins - Word MVP - 15 Mar 2008 03:32 GMT
Headers and footers are associated with Sections, not pages.  Therefore, it
is the Sections in a document that you need to cycle through

Dim i as long
   With ActiveDocument
       For i = 1 to .Sections.Count
           With.Sections(i)
               .Headers(wdHeaderFooterFirstPage).Range.Text =
               .Headers(wdHeaderFooterPrimary).Range.Text =
               .Footers(wdHeaderFooterFirstPage).Range.Text =
               .Footers(wdHeaderFooterPrimary).Range.Text =
           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

> Hi ,
>
[quoted text clipped - 8 lines]
>
> Thank you
cutecoder - 15 Mar 2008 09:51 GMT
Hi Doug Robbins,

thank you for your help it worked fine for me.

Regards

>Headers and footers are associated with Sections, not pages.  Therefore, it
>is the Sections in a document that you need to cycle through
[quoted text clipped - 16 lines]
>>
>> Thank you

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.