+ Reply to Thread
Results 1 to 6 of 6

Can I stop my Auto_Open macro from running?

  1. #1
    Registered User
    Join Date
    09-26-2008
    Location
    UK
    Posts
    2

    Unhappy Can I stop my Auto_Open macro from running?

    Having written an Auto-Open macro on an Excel Template and got it all nicely sorted, I then added code to remove the whole module after running it, so that when the new workbook is re-opened after saving as .xls it would not run the Auto_Open macro again. (The macro only being required to set up the new form from the template.)

    However I now cannot get back into the template macro to modify it, since each time I open it the Auto_Open macro runs right through and deletes itself!

    It is still there but I cannot open it without deleting it! I feel a bit stupid but don't want to re-write the whole thing.

    I seem to remember that there is a way to stop the Auto_open macro from running but I cannot remeber what it is.

    Help please.

  2. #2
    Registered User
    Join Date
    08-30-2008
    Location
    USA
    Posts
    30
    Possibly this will work...
    Hold down the SHIFT key when you open the workbook.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You need to create a new workbook from the template without enabling macros, then make the amendments in that workbook. Finally save the new workbook as the template to overwrite the original.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    08-30-2008
    Location
    USA
    Posts
    30
    Good morning, RoyUK:
    Quick question... will that work in all versions of Excel? I am using Excel2003. I can hold a shift key down and prevent an On-Open event from running. Just curious. Thanks.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    The OP is dealing with a template workbook (*.xlt), that is why I have suggested opening a new workbook from the template. By not enabling macros the auto open will not run & the workbook can be edited without it deleting the macro.

  6. #6
    Registered User
    Join Date
    09-26-2008
    Location
    UK
    Posts
    2

    Smile Thanks

    Thanks to you both,
    Obvious as soon as you suggested it Roy but none the less welcome.

    Proteusmime : The Shift key does not stop the macro running, on Excel 2002, perhaps because the Command to open the template is "New" rather than "Open"

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Use Event Procedure and OnTime to Stop a Macro
    By Protiusmime in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-26-2008, 07:46 PM
  2. Exit a running macro elegantly
    By kencoburn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2008, 11:24 AM
  3. Running Excel 4.0 Macro in Excel 2007.
    By CdSlc in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2008, 10:46 AM
  4. Running Macro Is Freezing Workbook
    By inwalkedbud in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2007, 02:21 PM
  5. Error Saving after running Macro
    By millen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2007, 09:14 AM

Tags for this Thread

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