A Visual Basic procedure that opens a workbook may halt in Excel (212074)
The information in this article applies to:
- Microsoft Office Excel 2003
- Microsoft Excel 2002
- Microsoft Excel 2000
- Microsoft Excel 97 for Windows
This article was previously published under Q212074 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 the code in the macro that occurs 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:
- Start Microsoft Excel, and then open the workbook that contains the macro.
- Point to Macro on the Tools menu, and then click Macros.
- Click the macro name you want, and then click Options.
- In the Shortcut key box, type a letter without holding down SHIFT.
- Click OK, and then click Cancel.
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
| Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
|---|
| Keywords: | kbbug kbpending KB212074 |
|---|
|