Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Remove/suppress Auto_Open macro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default Remove/suppress Auto_Open macro

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.


"Steve C" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Remove/suppress Auto_Open macro

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

Steve C wrote:

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


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Remove/suppress Auto_Open macro

That looks like a solution. I'll give it a try. Thanks!

"Dave Peterson" wrote:

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

Steve C wrote:

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


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto_Open Macro Trying to Excel Excel Discussion (Misc queries) 2 April 13th 07 07:08 AM
Force read-only in auto_open macro hhalle Excel Discussion (Misc queries) 0 August 20th 06 10:44 AM
auto_open-macro Mr.T Excel Programming 1 November 22nd 05 11:25 AM
Help with SaveAs Macro on Auto_Open Daen Excel Programming 3 September 15th 04 11:08 PM
Auto_Open vs. macro John Wilson Excel Programming 0 September 22nd 03 05:44 PM


All times are GMT +1. The time now is 11:50 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"