Remove/suppress Auto_Open macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created a template with an opening form launched by an Auto_Open macro.
Once a new spreadsheet is created and saved, I would like the form to be
supressed when the workbook is subsequently re-opened. Is there a way to do
this with an Auto_Close macro? Thanks.

Steve C
 
I have handled this a number of different ways. One, is that you could store
a value on a very hidden worksheet, and do a comparison of if that value is
present when opening. Could use the registry, although if you go to a
different computer and your registry didn't follow you, then oops. You could
do some other "investigation" that would look for an indicator. Also, you
could actually revise the base code prior in the before save of the document.
I can't remember which reference allows you to access/modify the VBA code
from within the VBA code, but I do know you want to be careful in
implementation. :) Delete one too many things, and you may have lost a years
worth of work. :) That one didn't happen to me, but sure was concerned.
 
If it's a real template that's creating a new workbook, you could use:

Option Explicit
sub auto_open()
if thisworkbook.path = "" then
'never been saved
'show userform
else
'it's not a template anymore
'do nothing
end if
end sub
 

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

Back
Top