This article has been archived. It is offered "as is" and will no longer be updated.
If you press and then hold down the SHIFT key while you use the Getting Started task pane to open a Microsoft Excel workbook, the code is not disabled. When you use the task pane to open a workbook that contains Microsoft Visual Basic for Applications macros or that references a managed code extension, the code always runs.
To prevent the code from running when you open a workbook, press and then hold down the SHIFT key while you use the File menu instead of the task pane to open the workbook.
Microsoft has confirmed that this is a bug in Microsoft Office Excel 2003.
Steps to Reproduce the Behavior
Create a new Microsoft Excel file that contains managed code extensions. To do this, follow these steps:
Start Microsoft Visual Studio .NET 2003.
On the File menu, click New, and then click Project.
Under Microsoft Office System Projects, click Visual Basic Projects, and then click Excel Workbook.
Click OK to start the Microsoft Office Project Wizard.
Click Create new document, and then click Finish.
In the Code window, replace the following code:
' Called when the workbook is opened. Private Sub ThisWorkbook_Open() Handles ThisWorkbook.Open End Sub
' Called when the workbook is opened. Private Sub ThisWorkbook_Open() Handles ThisWorkbook.Open MessageBox.Show("The Open Event Fired.")End Sub
Press the F5 key to build the project and then run the project.
The workbook opens in Excel, and a message box appears. Click OK to dismiss the message box.
Close the workbook. Do not close Excel.
On the View menu in Excel, click Task Pane to display the Getting Started task pane.
Press and then hold down the SHIFT key while you click the workbook in the Getting Started task pane.
When the workbook opens, the Open event from the managed code extension runs.
Click OK to dismiss the message box. Close the workbook.
Press and then hold down the SHIFT key while you use the File menu in Excel to open the workbook.
The Open event from the managed code extension does not run.