run macro automatically when opening a new doc based on template?

A

and

In Word XP, is it possible to have a macro run automatically when I open
a new document based on a given template (user selects the template in
the New Document side pane). How?

The purppose: I would like to have the Mail Merge toolbar to be
displayed always when I open a mailmerge document based on this template.

Is this the right statement to do this:
objWord.CommandBars("Mailmerge").Visible = True

Best,
ANDy
 
J

Jonathan West

and said:
In Word XP, is it possible to have a macro run automatically when I open a
new document based on a given template (user selects the template in the
New Document side pane). How?

Give the macro the name AutoNew
 
A

and

Thanks Jonathan.

And is there a special macro name for procedures that need to be
executed when this document is closed (to hide the Mail Merge toolbar
automatically)?

Best,
ANDy
 
J

Jonathan West

and said:
Thanks Jonathan.

And is there a special macro name for procedures that need to be executed
when this document is closed (to hide the Mail Merge toolbar
automatically)?


Yes, it is called AutoClose. Take a look in the VBA Help file for "Auto
macros" for more information on this.
 
J

Jeff

Read the online Help under "Auto Macros"

Macro name When it runs
AutoExec When you start Word or load a global template
AutoNew Each time you create a new document
AutoOpen Each time you open an existing document
AutoClose Each time you close a document
AutoExit When you quit Word or unload a global template
 

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