+ Reply to Thread
Results 1 to 4 of 4

VBA: Copy/Paste Header/Footer to multiple .docx

  1. #1
    Registered User
    Join Date
    01-21-2019
    Location
    Virginia, USA
    MS-Off Ver
    2013
    Posts
    2

    VBA: Copy/Paste Header/Footer to multiple .docx

    I am trying to copy/paste the header/footer from the source document, which contains the vba, into *.docx files within the same folder not including sub-folders. There are no errors generated, each .docx file has been opened/saved but does not contain the header/footer of the source document. I can post the code I have if that would assist, or perhaps a respondant could post code I could use to replace my existing code.


    Eggy
    Office 2013

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: VBA: Copy/Paste Header/Footer to multiple .docx

    Without seeing your code, it's impossible to know why it isn't working. As for alternative code, try:
    Please Login or Register  to view this content.
    Last edited by macropod; 01-21-2019 at 06:10 PM.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    01-21-2019
    Location
    Virginia, USA
    MS-Off Ver
    2013
    Posts
    2

    Re: VBA: Copy/Paste Header/Footer to multiple .docx

    Since I'm new to the forum, I'm unable to post any code, links, images, etc.
    However the results between the two codes appear the same. The .docx files have been updated date/time stamp,
    however, none of the header/footers from the source document have been copied over to the files. The source document only has a first page header/footer.
    I've also ran a vba script to clear all of the header/footers from the target .docx document prior to pasting from the source .docm document and had no success.
    The header/footer of the target doucument always seems to be empty.
    The header/footers of the source document does contain images and text boxes. Could this be causing the issue?
    Last edited by Eggyjla74; 01-22-2019 at 08:22 AM.

  4. #4
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: VBA: Copy/Paste Header/Footer to multiple .docx

    Quote Originally Posted by Eggyjla74 View Post
    The source document only has a first page header/footer.
    And therein lies the problem. Word has three header/footer types: primary, first page and even page. The code I posted assumed a primary header, which is the default. Change:
    wdHeaderFooterPrimary
    to:
    wdHeaderFooterFirstPage

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Copy Header and Footer from a document
    By mgaworecki in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 12-04-2015, 05:33 PM
  2. [SOLVED] Copy header and paste to multiple sheets
    By ATLGator in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-05-2013, 07:25 PM
  3. Copy & Paste pictures from Excel into Header (and Footer) of Word
    By RogerPang in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2012, 04:52 AM
  4. Copy header and footer
    By Samantha McNeill in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-09-2011, 12:33 PM
  5. Macro to copy & paste the contents of a docx file into xls?
    By Cheshire in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2010, 02:48 PM
  6. Replies: 10
    Last Post: 01-12-2006, 09:55 PM
  7. Copy & Paste Header/Footer?
    By CB Payne in forum Excel General
    Replies: 1
    Last Post: 05-19-2005, 12:36 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1