On 7/26/06 4:45 PM, in article
1153946707.519916.314030@i42g2000cwa.googlegroups.com, "mdc1952"
<michaelconner@missouristate.edu> wrote:
> I'm creating a template that will be opened by users and saved to a new
> name based on info provided by the user. I have macros triggered by
[quoted text clipped - 10 lines]
> Is there some method I can use to cleanly get out of the On open sub
> when I want to abort and still have a BeforeClose sub?
The reason this is happening is Excel's VBA stack. You'll need to set some
global flags and make sure the open sub has completed. You can test for the
flags in another sub or the close event sub.

Signature
Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom
mdc1952 - 26 Jul 2006 22:37 GMT
Thanks for the info. I figured it was something like this, but I'm not
into the plumbing of VBA. However, I still don't see how to accomplish
what I want.
If I let the Open macro complete, bypassing the remainder of the macro
if the user indcates canceling, how to I trigger closing within VBA? If
the Open macro completes without an Activeworkbook.close statement
things will just sit there until the user initiates closing.
Is there a way to terminate the open sub from within the close sub if I
create a flag to indicate closing started during the open sub?
Thanks for your help.
Bob Greenblatt - 27 Jul 2006 12:32 GMT
On 7/26/06 5:37 PM, in article
1153949843.460994.167900@p79g2000cwp.googlegroups.com, "mdc1952"
<michaelconner@missouristate.edu> wrote:
> Thanks for the info. I figured it was something like this, but I'm not
> into the plumbing of VBA. However, I still don't see how to accomplish
[quoted text clipped - 9 lines]
>
> Thanks for your help.
You could have the close sub set a flag that is examined in the open sub.

Signature
Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom