Results 1 to 7 of 7
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy Headers/Footer (Word 97/2000/...)

    Hi,

    Is it possible to copy (the CONTENTS of) headers and footers from one section to another? This is using a MACRO, i.e. in the background without the knowledge of the user.

    Thanks.

    Robie
    Thanks.
    Robie

  2. #2
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    Quakertown, PA, Pennsylvania, USA
    Posts
    517
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Headers/Footer (Word 97/2000/...)

    I cannot for the life of me figure out why you'd want to do that.
    Using "Same as Previous" does it for you...
    And...what if the user is in Print layout view? How do you expect to keep such an action from the user?

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Headers/Footer (Word 97/2000/...)

    You are absolutely correct in using 'Same as Previous' but I am getting unsual/expected results. This is the structure of my template/document:

    Section 1 - Cover Page (no header - simple footer)
    Section 2 - Change History table (no header - copyright statement plus extra as footer)
    Section 3 - TOC (header & footer)
    Section 4 - User' document (header & footer [different from TOC])
    Section 5 - Back Pages (Blank page & the next page is company addresses plus other information) - NO HEADERS & NO FOOTERS

    I find that the users are updating (section 5) inadvertenly and adding information into the BLANK page. They should be adding information at the end of section 4 and not at the beginning of section five (which is a blank page). This means that there are NO header & footers for that information. User's are complaining that they are losing there headers and footer for new information added. Therefore, I am trying to sort out the headers and footers when they open the document automatically using a macro. But when I use 'Same as Previous' the header is BLANK and the footer contains the footer from section 2 (i.e. the copyright statement). I expected it to contain headers/footers from section 4.

    I know a sample document would make the explanation easier but my company is not allowing me upload anything. I have requested but I don't know how long it would take for me to do that.

    I hope this is more clearer & thanks for reading/responding to the question.

    BTW: Is it possible not to allow the users to type anything in the last section?

    Robie
    Thanks.
    Robie

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Copy Headers/Footer (Word 97/2000/...)

    Would it be acceptable to protect the document for forms, and specify that only the last section is protected? It would prevent the users from entering anything in section 5, but it has the drawback of disabling some functionality in the unprotected sections too.
    Alternatively, you could use application-level events (see the thread starting at <post#=337212>post 337212</post#>), but the one you need was introduced in Word 2000, so it is not available in Word 97.

  5. #5
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Copy Headers/Footer (Word 97/2000/...)

    If .LinkToPrevious isn't working, I don't know that you won't also get unusual/unexpected results with this approach, but just in case it's helpful, here's some sample code that will (normally) copy the contents of the Section 4 primary footer to the Section 5 primary footer (and adjust two PageNumbers settings):
    <pre> Dim docX As Word.Document
    Dim ftrSource As Word.HeaderFooter
    Dim ftrTarget As Word.HeaderFooter

    Set docX = ActiveDocument

    With docX
    Set ftrSource = .Sections(4).Footers(wdHeaderFooterPrimary)
    Set ftrTarget = .Sections(5).Footers(wdHeaderFooterPrimary)
    End With

    ftrTarget.LinkToPrevious = False

    With ftrTarget.PageNumbers
    .NumberStyle = ftrSource.PageNumbers.NumberStyle
    .RestartNumberingAtSection = False
    End With

    ftrSource.Range.Copy
    With ftrTarget.Range
    .Paste
    .Characters.Last.Delete
    End With

    Set ftrSource = Nothing
    Set ftrTarget = Nothing</pre>


  6. #6
    5 Star Lounger st3333ve's Avatar
    Join Date
    May 2003
    Location
    Los Angeles, California, USA
    Posts
    705
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Copy Headers/Footer (Word 97/2000/...)

    Another thought has occurred to me. If Section 5 is set up to have a Different First Page Footer (see the checkbox in the Layout tab of the Page Setup dialog), and if Section 2 also has a Different First Page Footer but Sections 3 and 4 don't (i.e., if Sections 3 and 4 just have Primary footers), that would explain why Same As Previous (if it's set to True in the First Page Footer of Section 5) causes the Section 2 footer to show up in Section 5 -- or, more precisely, causes the First Page Footer from Section 2 to show up in the First Page Footer for Section 5.

  7. #7
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Headers/Footer (Word 97/2000/...)

    Thanks to you and everyone. Few more things for me to try out and think about. I have been away for a while therefore could not try out some of the things suggested for the problem. I should be able to look into it bit more this week.

    You all are so good. Thanks.
    Thanks.
    Robie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •