Disable the macro

K

Ken

Hi,

Is there any way to tell the macro to only run once, or
disable it in some way after the auto-save, then maybe
pop-up windows only be seen once? Thanks!

Ken
 
J

JGM

Hi Ken,

Put your code in the ThisDocument.Document_New event.

Otherwise, if the macro is executed after some user prompt, then, for
example, you can:

Create a DocumentVariable (See the VBA help., it is full of examples)

Let's call it "RunOnceOnly"
When you create it, give it a value of 0.
At the end of your code, change th value to 1.
At the beginning of the code, check for the value of
RunOnceOnly. If it it is greater than 0 (or equal to 1), then the code has
been run at least once, so Exit Sub...

HTH
Cheers!
 
Top