XL97: Visual Basic Procedure Halts on Workbooks.Open

Last reviewed: January 7, 1998
Article ID: Q175223
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

In Microsoft Excel, when you run a Visual Basic for Applications Sub procedure that opens a workbook, the procedure may halt before all the code in the Sub procedure is executed.

NOTE: When the Sub procedure halts, Microsoft Excel is in "design mode." All code in the macro before the code that opens the workbook is executed.

CAUSE

This behavior occurs when the following conditions are true:

  • You assign a shortcut key to the macro.

        -and-
    
  • You press the shortcut key to run the macro.

        -and-
    
  • The SHIFT key is part of the shortcut key (for example, CTRL+SHIFT+A).

        -and-
    
  • The macro code opens a workbook by using the Open method (for example, Workbooks.Open).

RESOLUTION

To resolve this problem, remove SHIFT from the macro shortcut key combination when the code includes Workbooks.Open. To change the shortcut key for a macro, follow these steps:

  1. Start Microsoft Excel and open the workbook that contains the macro.

  2. Point to Macro on the Tools menu, and then click Macros.

  3. Click the macro name in the list and click Options.

  4. In the Shortcut Key box, type a letter without holding down SHIFT.

  5. Click OK, and then click Cancel.

STATUS

Microsoft has confirmed this to be a problem in the products listed above. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

To assign a shortcut key to a macro, follow these steps:

  1. On the Tools menu, point to Macro, and then click Macros.

  2. In the Macro name box, enter the name of the macro you want to assign to a shortcut key.

  3. Click Options.

  4. To run the macro by pressing a shortcut key, type a letter in the Shortcut Key box.

    You can use CTRL+<letter> or CTRL+SHIFT+<letter> where <letter> is any letter key on the keyboard. The shortcut key overrides any default Microsoft Excel shortcut key assignments while the workbook that contains the macro is open.

  5. Click OK, and then click Cancel.


Additional query words: XL97
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbwontfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 7, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.