Insert a file as part of a macro

K

kharrison

I have created a macro where I am inserting an existing file (a template)
into a new documet. The problem is the headers and footers on the existing
file are not inserting into the new document. How do I make this occur.

Or how do I create a macro where the a .doc is created from the template.

Any help much appreciated.

Kris
 
D

Doug Robbins

You would have more chance if you created a new document from the template
and then inserted the document into that.

Something like

Dim Source as Document, Target as Document, doctext as Range

Set Source = ActiveDocument 'The document containing the text
Set Target = Documents.Add("[path\template]")
Set doctext = Source.Range
doctext.End=doctext.End - 1
Target.Range.FormattedText=doctext.FormattedText

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top