none
Can I share two templates to create one document? RRS feed

  • Question

  • My workplace, in its wisdom, has decided to stop using pre-printed letterhead, and introduce a word template with company header & footer.

    The problem is, we have multiple template documents that we use and am hoping there's someway of getting the existing templates to print using the new letterhead template, without having to physically copy the text from the existing templates into the new letterhead template and re-save them.

    My main concern, about from a lot of time wasted, is that if they update/change the letterhead template, we'll have to go back and change all the existing templates again - not smart in my humble opinion.

    I'd really appreciate instructions if anyone knows how I can resolve this problem.

    Thanks

    Deb

    Thursday, July 23, 2015 9:44 PM

Answers

  • There is no way to have one Word document use two templates. Accordingly, you will need to have separate templates for the letters requiring the letterhead and those that don't. That also means editing all the templates for the letters requiring the letterhead.

    To cater for letterhead changes, you could insert INCLUDETEXT fields in the template header/footer/body pointing to a document containing your standard header/footer/body content, with that content bookmarked (separate bookmark for each). Each INCLUDETEXT field would referencing the source document and its own bookmark. Then, in each template's 'ThisDocument' code module, you could insert a macro coded as:

    Sub Document_New()
    Application.ScreenUpdating = False
    Dim i As Long, HdFt As HeaderFooter
    With ActiveDocument
      For i = .Fields.Count To 1 Step -1
        If .Fields(i).Type = wdFieldIncludeText Then .Fields(i).Unlink
      Next
      For Each HdFt In .Sections.First.Headers
        With HdFt.Range
          For i = .Fields.Count To 1 Step -1
            If .Fields(i).Type = wdFieldIncludeText Then .Fields(i).Unlink
          Next
        End With
      Next
      For Each HdFt In .Sections.First.Footers
        With HdFt.Range
          For i = .Fields.Count To 1 Step -1
            If .Fields(i).Type = wdFieldIncludeText Then .Fields(i).Unlink
          Next
        End With
      Next
    End With
    Application.ScreenUpdating = True
    End Sub

    Of course, if there was only ever one field to deal with, the code could be greatly simplified. In the real world, however, someone always finds a way to 'need' something different.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Friday, July 24, 2015 7:47 AM

All replies

  • There is no way to have one Word document use two templates. Accordingly, you will need to have separate templates for the letters requiring the letterhead and those that don't. That also means editing all the templates for the letters requiring the letterhead.

    To cater for letterhead changes, you could insert INCLUDETEXT fields in the template header/footer/body pointing to a document containing your standard header/footer/body content, with that content bookmarked (separate bookmark for each). Each INCLUDETEXT field would referencing the source document and its own bookmark. Then, in each template's 'ThisDocument' code module, you could insert a macro coded as:

    Sub Document_New()
    Application.ScreenUpdating = False
    Dim i As Long, HdFt As HeaderFooter
    With ActiveDocument
      For i = .Fields.Count To 1 Step -1
        If .Fields(i).Type = wdFieldIncludeText Then .Fields(i).Unlink
      Next
      For Each HdFt In .Sections.First.Headers
        With HdFt.Range
          For i = .Fields.Count To 1 Step -1
            If .Fields(i).Type = wdFieldIncludeText Then .Fields(i).Unlink
          Next
        End With
      Next
      For Each HdFt In .Sections.First.Footers
        With HdFt.Range
          For i = .Fields.Count To 1 Step -1
            If .Fields(i).Type = wdFieldIncludeText Then .Fields(i).Unlink
          Next
        End With
      Next
    End With
    Application.ScreenUpdating = True
    End Sub

    Of course, if there was only ever one field to deal with, the code could be greatly simplified. In the real world, however, someone always finds a way to 'need' something different.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Friday, July 24, 2015 7:47 AM
  • Thank you so much for your response Paul, I had figured this was pretty much the case, but it never hurts to ask.

    I'll give your suggestion a go, but suspect it's going to be a long cut & paste job ahead.

    Thanks again

    Deb

    Friday, July 24, 2015 9:11 AM