View Single Post
 
Old 03-05-2015, 06:57 AM
mrkozmic mrkozmic is offline Windows 8 Office 2013
Novice
 
Join Date: Mar 2015
Posts: 6
mrkozmic is on a distinguished road
Default

Thanks gmayor!
Your solution works fine!

The template is not open as a regular document, but since it is attached to the document it seems as it is somehow "open"

I do copy other things from the template, eg. code below.I can also copy content controls and images. And as I wrote, It works if I step through the code. Maybe there-s a trick to do this without opening the doc?
HTML Code:
ThisDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Copy
        ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Paste
        'a linebreak is always added at the end, remove it
        ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Paragraphs(ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Range.Paragraphs.Count).Range.Delete
Reply With Quote