+ Reply to Thread
Results 1 to 5 of 5

Stop Workbook_Open macro

Hybrid View

  1. #1
    Registered User
    Join Date
    05-11-2007
    Posts
    22

    Stop Workbook_Open macro

    Hello everyone,

    I was wondering if there was a way to stop a WorkBook_Open macro from running. Apparently, there is something wrong with the code (maybe an infinite loop somewhere or a really bad query) and it is located in the WorkBook_Open function, so I need a way to turn it off in order to setup breakpoints and debug it. Any help would be greatly appreciated, thanks!

  2. #2
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    One option that I've used is to open the workbook with macros disabled then
    add a message box indicating where you are in the code. Save the workbook
    then close and reopen it, this time enabling the macros.
    When the message box pops up in the Workbook_Open sub before responding
    to the message box enter break mode (hit [Ctrl]+[Break]) and then you can
    step through your code or add breakpoints, etc.

    HTH
    Last edited by bhofsetz; 06-11-2007 at 12:07 PM.

  3. #3
    Registered User
    Join Date
    05-11-2007
    Posts
    22

    How to open with disabled macros

    Hi bhofsetz,

    How do you open the workbook with disabling macros? I know that it usually prompts you whether you want to enable or disable macros before the workbook is opened, but I am not receiving that prompt for some reason. Any ideas?

  4. #4
    Registered User
    Join Date
    05-11-2007
    Posts
    22

    Talking Got it =)

    Nevermind, I managed to interrupt the code by spamming ctrl+break once I opened the workbook. Thanks a lot for your help!

  5. #5
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    Your security settings are probably set to low and that is why you are not
    receiving the message. Change the security settings to Medium and then
    you should receive the message to enable or disable macros upon opening
    the workbook.

    HTH

+ 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