Word InsertFile() not bring over header and footer RRS feed

  • Question

  • Hi All,

    I have a document and I am trying to use the Insertfile() to insert another file into my document.  The problem is it is not bringing over the header and footer from the document I am inserting.  Does anyone know a way around this?  The first document is a word output from another application.  The second document is a template.  I would like to Insert the Template file into the output file but I really need the header and footer.



    Friday, April 16, 2010 4:20 PM

All replies

  • I had to do something similar a few years back.  I had a template file and I had to insert a 1 to 2 page word document.  I could never get the header to insert.  In one test I opened the doc, copied the header and pasted it into the template.  This messed up the template header.  I ended up converting the small doc to gif images, shrinking them a little and inserting the images.  This solution was acceptable.  I'll monitor this posting to see if you have any better luck.
    Sunday, April 18, 2010 7:19 PM
  • Hello,

    I'm using Word 2007 and use following macro could bring the Footer/Header over:
    Sub Macro5()
    ' Macro5 Macro
        Selection.InsertFile FileName:="test.dotx", Range:="", _
            ConfirmConversions:=False, Link:=False, Attachment:=False
    End Sub


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, April 20, 2010 9:11 AM
  • Hmm.... for some reason that doesn't seem to be working for me.  I copied the code exactly and it still wont pull over my footer.
    Wednesday, April 21, 2010 2:02 PM
  • Hi ITGuy85,


    Did you ever figure out how to get the InsertFile method to bring over the header and footer from the source document?  I am doing the same as yourself and banging my head against the wall.  Using WORD 2007 and VBA........In my destination document I am inserting a page break before the insertfile method.    The funny thing is once in  awhile, one of my many documents the footer will show up.  There seems to be no rhyme or reason.  Anyway, just curious if you had any luck.


    Thanks in advance!

    Thanks SB!
    Thursday, October 20, 2011 3:59 AM
  • Word uses the header/footer from the first document when the second document is inserted.  What I do is create a template with the desired header/footer.  Then create a new document based on this template and then insert the document you want.  The header/footer in the template overrides the header/footer in the document.  I recommend creating the template with unique style names.  The template style names override the document style names.  It was driving me crazy when a font would change from Arial 14 to Times Roman 12.  Turns out the header 1 style in the template was overriding the header 1 style in the document. 

    If you want to use the header/footer in the document rather than the template I think you can insert a section break.  I use this feature when merging documents that switch from portrait to landscape. 

    Thursday, October 20, 2011 2:00 PM