Solved

Programmaticaly add letterhead template to existing Word Doc

Posted on 2009-05-15
2
555 Views
Last Modified: 2012-05-07
I have patient dictations that are prepared by a transcription department.  We currently print them on letterhead.  I am trying to eliminate the cost of buying, and use a word template, which I already have.

I want to programmatically (from Access) open each file and apply the template and resave it.  I already am opening each file and copy the text from it for another routine.

I would simply need a routine addition such as:

If there is no template, or if the template is Normal.DOT

  Then change to OTHER.DOT
   Save
   Close


Does this make sense?

Thanks for any help.

Troy

0
Comment
Question by:toverholt
2 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 250 total points
ID: 24397098
You can attach another template to a document programmatically with

If  Doc.AttachedTemplate = NormalTemplate then
     Doc.AttachedTemplate = "C:\MyTemplates\NewTemplate.doc"
endif

but I doubt that it will do what you want.

The document part of a template is only used when a the document is first created. Thereafter the template parts such as macros, toolbars and styles can be employed, but text, layout etc. would not be affected simply by changing the template.
0
 
LVL 9

Assisted Solution

by:jkunrein
jkunrein earned 250 total points
ID: 24397130
Graham is quite right that applying a template does not apply the text.

You could, however, create an AutoText within that template.  Then, when you attach the template, you can insert the AutoText in the header of the document.  

This is an extra step in your VBA code, but it may do what you want.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question