+ Reply to Thread
Results 1 to 4 of 4

Remove/suppress Auto_Open macro

  1. #1
    Steve C
    Guest

    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. #2
    GB
    Guest

    RE: 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. #3
    Dave Peterson
    Guest

    Re: 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. #4
    Steve C
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1