#1
|
|||
|
|||
Copy paste Header and Footer using VBA
Greetings,
I am searching for a solution for this problem, i am trying to find out a way to get the header and footer from a document and using vba macros to get them pasted over to other documents. I need this to waste as little time copy pasting a certain header and footer for my company project where every file needs to have the same header and footer. Thank you for your time! |
#2
|
||||
|
||||
There are potentially three headers and three footers for each section of a document. Which headers and footers are used in the source document and which are to be used in the target documents? Without this information the results may not be what you expect and could take even more time to address.
For new documents, create a template from your source document that contains the headers and footers and create new documents from it.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Quote:
Thank you in advance! |
#4
|
||||
|
||||
That's all very well, but you need to have a sound understanding of a Word document's structure before you can do this.
First: A document can contain multiple Sections. The second and subsequent sections may or may not have their headers & footers linked to the preceding Section. Second: Every Section in a Word document has three header and footer objects: • first page; • even page; and • primary. The 'primary' header and footer are always active; whether the 'first page' and/or 'even page' header and footer are active for a given Section depends on what page layout options have been chosen for the document/section. You can't use the 'first page' and/or 'even page' header and footer unless the appropriate page layout options have been chosen. Anything added to a 'first page' header or footer will only appear on the first page of the Section concerned (and the subsequent Section's 'first page' header or footer if that Section's page layout options provide for one and the subsequent Section's 'first page' header or footer, as appropriate, is linked to the previous Section's corresponding 'first page' header or footer). Anything added to an 'even page' header or footer will only appear on the even pages of the Section concerned (and the subsequent Section's 'even page' header or footer if that Section's page layout options provide for one and the subsequent Section's 'even page' header or footer, as appropriate, is linked to the previous Section's corresponding 'even page' header or footer). Subject to the the 'first page' and/or 'even page' page layout options, anything added to a 'primary' header or footer will appear on every page of the Section concerned (and the subsequent Section's 'primary' header or footer if that Section's 'primary' header or footer, as appropriate, is linked to the previous Section's corresponding 'primary' header or footer). So, before anything could be coded, one would need to know whether: • your source document has provided for all three header & footer objects; • how you want the headers & footers in your target documents to be handled. For example, should the target documents be modified so that the header(s) & footer(s) from your source document be replicated only on the first page in them, or on the first page in every Section (this, of course, presupposes you already know how those documents are structured and what outcome would be appropriate).
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thank you for your time It was very helpful! Have a nice day
|
Tags |
header |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to copy header and footer? | Abcde | Word | 1 | 06-02-2017 06:08 AM |
How to copy excel sheet withe HEADER and Paste into new sheet? | cloudforgiven | Excel Programming | 6 | 01-05-2017 07:30 PM |
Copy RightFooter, Delete Entire Footer, and Paste to LeftFooter | reynolds0431 | Word VBA | 8 | 08-26-2015 09:01 PM |
Header and footer aligned in the footer area | ashiqghfr | Word | 2 | 07-23-2015 01:14 AM |
Paste Special: Copy and Paste Formatting Only? | tinfanide | Word | 6 | 03-06-2013 12:21 AM |