Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

Apply template to a document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rael_lucid - 25 Sep 2006 06:38 GMT
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
Jezebel - 25 Sep 2006 07:31 GMT
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.

> Hi everyone,
>
[quoted text clipped - 22 lines]
>
> Rael
rael_lucid - 25 Sep 2006 07:48 GMT
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

> 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
[quoted text clipped - 34 lines]
> >
> > Rael
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.