Apply template to a document

R

rael_lucid

Hi everyone,

Not an experienced Word programmer but have experience with Access and Excel
VBA.

I am trying to write some code which applies a user specified document
template to the current document.
The user will select the document template from a combobox (choice of:
Email, Letter, Fax) and I would like my program to then apply the formatting
of the template to the current document. Formatting includes all styles etc,
but also includes headers, footers and images.

I have noticed that there is a command ActiveDocument.AttachedTemplate
which handles the styles only. I am looking for more than this obviously.

Is there a command that I have overlooked or will I have to write code to
copy the text of the active document, open the template and then paste the
text into the template? This method will work, but it seems a little messy
and inefficient.

Any ideas appreciated!

Rael
 
J

Jezebel

You're right that applying a template is mostly about styles: attaching a
different template does nothing to the content of the document. There are
various ways to populate the content of a template -- it depends on what
you're trying to do, and what the original content is like. Copying the
content of the original document and pasting it into the new is one method.
It can indeed be a bit messy, but documents are like that. If the source
document has multiple sections with different page formats, different
headers and footers, etc, then the exercise is quite a challenge. Likewise
if the user has done a lot of manual formatting: frames or textboxes
juxtaposed on graphics, or subtle positioning relations can all be very
difficult to deal with automatically.
 
R

rael_lucid

Fortunately, the source document is all text with a single style.
Having a look at the target templates, they are also quite straightforward
in that the insertion point fpr the source data is easily identified.

Thanks for the advice.

Rael
 

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