PDA

View Full Version : Solved: AutoOpen Problem



DonCard
06-09-2006, 12:43 PM
I have a macro in a document that runs a series of 12 separate merges then combines each merge document into one final document. The original document is only a platform for doing the merges and consolidation; the final document is saved as a separate document. This worked fine until I decided to "simplify the process" by naming the macro AutoOpen. The problem is the final document contains the AutoOpen macro as well and of course the macro runs as soon as that document is opened. How do I get rid of the AutoOpen macro in the final document?

fumei
06-09-2006, 03:34 PM
Easy.

1. make it from a template.
2. in the ThisDocument module of the template, put your code in the Document_New event. NOT AutoOpen.
3. When you invoke the template (that is, make a New document with File > New), Document_New will fire all your stuff. The document saved from the clone from the template (ie. your final document) will NOT have Document_New - so there will be nothing to fire when it is opened.

DonCard
06-13-2006, 07:04 AM
Thanks Gerry, worked like a charm. My knowledge of templates is sorely lacking, any good sources of info you could suggest?

fumei
06-13-2006, 12:24 PM
Hmmm. Hard to say. There are a few good books on Word, and most of them cover templates. However, none of them cover templates to any real depth. This is unfortunate as templates and styles are the back bone of how Word is designed to be used.