Where to put a macro that I want to run when Word closes?

S

Stephen English

I want to run a macro when the user closes Word rather than when they close a
document. Is there a place to put this please?
Regards
Stephen English
 
J

Jezebel

It can go in any loaded template or add-in. If this is purely for your own
use, normal.dot is simplest. If it's for distribution, create an add-in.
 
M

MacroView

Use the AutoExit macro as it runs when Word quits. If its not just for
persoal use then don't store on Normal.dot but on a global template in
your Startup folder.
 
J

Jonathan West

MacroView said:
Use the AutoExit macro as it runs when Word quits. If its not just for
persoal use then don't store on Normal.dot but on a global template in
your Startup folder.

Be aware that strictly speaking AutoExit is not run when Word closes, it is
run when that template is unloaded.

If the AutoExit is in normal.dot, normal.dot is only ever unloaded
immediately prior to Word closing so this is a distinction is without much
of a practical difference. But for add-ins, the AutoExit macro will run also
if you go to Tools, Templates and add-ins, and uncheck the template in the
addins list.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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