Triggering a macro to run when a template is used to create a new document

M

marc

I created a new Word template, and I would like a
macro to run automatically when the user creates a new
document from the template. The macro is attached to the
template, and I named the macro: Document_New
The macro runs automatically (and does what I want it
to do) when I open the template. But the macro does not
automatically run when I create a new document from the
template.
What do I have to do to get the macro to run
automatically?
 
S

Steve Lang

HI Mark,

The name is right, but do you have it in the right place?

In the VB Environment, find your template. Under that, there is a section
called "Microsoft Word Objects" and under THAT there is "ThisDocument".
Double Click it.

On the left had drop down list in the code editor window, the selection
should be "(General)", make it "Document". This is where you want to place
your Document_New sub code that will fire every time a new document is
created based on that template.

HTH and have a great day!

Steve
 

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