Dian
Tue Oct 31 12:08:22 CST 2006
Okay, in that case what you really want is to create the master
template and put the macro in the ThisDocument module under the NEW
event. So the macro will be called ThisDocument_New, versus AutoOpen.
Within the ThisDocument module (which is the new way to use Auto
macros...the old "Auto" named macros are more for legacy purposes),
you have a few events listed in the drop down within that module (to
the right). One is New and one is Open.
If you put your opening code in the NEW event...then it'll only run
when the user creates a new document from that master template.
Once the doc is created and saved...since nothing is in the OPEN
event, it won't fire the macro again.
Also do check out the article Jay referenced.
Dian D. Chapman
Technical Consultant, Microsoft MVP
MOS Certified, Editor/TechTrax
Free MS Tutorials:
http://www.mousetrax.com/techtrax
Free Word eBook:
http://www.mousetrax.com/books.html
Optimize your business docs:
http://www.mousetrax.com/consulting
Learn VBA the easy way:
http://www.mousetrax.com/techcourses.html
On Tue, 31 Oct 2006 06:56:02 -0800, SandiK
<SandiK@discussions.microsoft.com> wrote:
>I created a document that when opened, automatically runs a macro to require
>users to complete four userforms that will automatically populate the Word
>document. The problem we are having now is that when the document is
>completed and saved, then later opened if one correction or change needs to
>be made the user has to go through the entire macro again. We would like the
>macro to run only on open from the base document. I had used the template
>format first, but the department didn't want the staff to open it wrong and
>actually use the template itself and not a new document from the template.
>So, i used the AutoOpen macro which works great; however, it would be better
>if I could somehow have it disable after the file-save-as prompt in vba at
>the end of execution. I am working with Word 2003. Any assistance would be
>great!
>
>Thanks!
>
>"Dian D. Chapman, MVP" wrote:
>
>> I don't quite know if I'm answering your question as you need since I
>> don't understand the second part of what you're asking...but to
>> disable Auto macros...hold down the SHIFT key for the ENTIRE time the
>> document is opening.
>>
>> Hope that helps. If not, please provide more specific information.
>>
>> Dian D. Chapman
>> Technical Consultant, Microsoft MVP
>> MOS Certified, Editor/TechTrax
>>
>> Free MS Tutorials:
http://www.mousetrax.com/techtrax
>> Free Word eBook:
http://www.mousetrax.com/books.html
>> Optimize your business docs:
http://www.mousetrax.com/consulting
>> Learn VBA the easy way:
http://www.mousetrax.com/techcourses.html
>>
>>
>>
>> On Mon, 30 Oct 2006 15:13:02 -0800, SandiK
>> <SandiK@discussions.microsoft.com> wrote:
>>
>> >How do I disable the auto open macro after the document has been executed and
>> >saved in a different location so that when that document is opened to view
>> >the infomration or make changes, the macro doesn't run?
>>
>>