VBA Bug: Macro in Excel Stops After A Workbook.Open Command

Hi Everyone.

Although I have already reported this as a KB article sometime ago, I decided it to be useful to post this here too:

Sometimes Excel VBA behaves unexpectedly. Here is an example:

You are running code that is meant to open one or more files using the Workbooks.Open command. As soon as you hold down the shift key when this command is being processed, macro execution stops and your program is terminated entirely. This will even happen if you are e.g. editing an email message in Outlook whilst Excel VBA is processing the code in the background.

Read more on this page.


Jan Karel Pieterse

Posted in Uncategorized

7 thoughts on “VBA Bug: Macro in Excel Stops After A Workbook.Open Command

  1. I know in Access shift is the bypass key. Is it possible that pressing shift during the open command is setup as a bypass key?

    I have noticed that when launching an Excel workbook from Windows shift does not bypass anything though.

  2. Shift is the bypass key in Excel. It’s a way of stopping any macros running as you open Excel (used to be helpful before the dialog box now that gives the option to Enable or Disable macros).

  3. Not a bug. Same thing happens in Word and is the same in MS Access, and for those of us from the Windows 3.11 days, holding the shift key down would cause startup items in the win.ini file not to load.

    I don’t know what I would do without the shift key being enabled. It is documented as not a bug at the microsoft site.

  4. As a workaround, create another excel, set macro security to highest, and save. Now when you open the original excel, you will be able to bypass the macro that is activated by workbook_open

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.