I'm writing a script to merge 2 Word templates into 1 master document, depending on some criteria. This is what I have so far:
{if mergefield effort_ } = 5 "{ includtext "C:\\1\\PL5.doc"}" ""{includetext "C:\\1\\PL6.doc"}"}
The merged doc works fine, but in my PL5 and PL6 files, I have some headers and footers. The merged doc can only contain the main content of the merging letters. I was able to google some code, but it doesnt work. Will you please help?
Sub mklink()
Dim w As Range
Dim p As String
Dim q As String
Dim s As String
''# select current word
Set w = Selection.Range
w.Expand
''# bookmark it
ActiveDocument.Bookmarks.Add Range:=w, Name:="bm"
''# create the link field code text
p = ActiveDocument.FullName
q = Replace(p, "\", "\\") 'Must escape filename backslashes
s = "link word.document.12 " & q & " bm \a \r"
''# Put field code in footer
With ActiveDocument.Sections(1)
.Footers(wdHeaderFooterPrimary).Range.Fields.Add Range:=.Footers(wdHeaderFooterPrimary).Range, Text:=s
End With
End Sub