Microsoft KB Archive/824005

= PRB: Workbook Open Event Is Not Raised for Managed Code Extensions =

Article ID: 824005

Article Last Modified on 11/26/2007

-

APPLIES TO


 * Microsoft Office Excel 2003
 * Microsoft Visual Studio Tools for the Microsoft Office System version 2003

-





SYMPTOMS
You create a managed code extension for Microsoft Office Excel 2003 by using Microsoft Visual Studio Tools for the Microsoft Office System. When you open your workbook in Excel, you notice that your managed code extension does not handle the Open event in your workbook.



CAUSE
This problem may occur if the Excel workbook is not saved in the .xls file format.

The only supported file format for Excel managed code extensions is the .xls file format (Microsoft Excel 97 through 2003 only). For more information, see the section &quot;Supported Document Formats for Managed Code Extensions,&quot; in the topic &quot;Architecture of Office Solutions That Use Managed Code Extensions,&quot; in the Visual Studio Tools for Office documentation.



MORE INFORMATION
The Open event may not be raised if you save your workbook in the XML Spreadsheet file format. The Open event is not raised when you open the workbook from a command line, from Microsoft Windows Explorer, or by running your managed code extension in Microsoft Visual Studio .NET. However, if you start Excel, and then you open the workbook from the Excel File menu, your managed code extension raises and handles the Open event.

Steps to Reproduce the Behavior
 Create a new Microsoft Visual Basic Excel Workbook project. To do this, follow these steps:  Start Microsoft Visual Studio .NET 2003. On the File menu, point to New, and then click Project. Under Microsoft Office 2003 Projects, click Visual Basic Projects, and then click Excel Workbook under Templates. Name the project OpenTest. In the Location text box, type &quot;C:\&quot;. Click OK.

The Microsoft Office Project Wizard appears. Click Finish.</li></ol> </li>  Add the following line of code to the ThisWorkbook_Open event procedure: MessageBox.Show(&quot;This is the Open event.&quot;) </li> On the Build menu, click Build Solution.</li> Start Windows Explorer.</li> Double-click C:\OpenTest\OpenTest.xls to open the workbook in Excel.

The message box appears.</li> In Excel, click Save As on the File menu.</li> In the Save as type drop-down list box, click XML Spreadsheet, and then click OK to save the file.</li> Quit Excel.</li> Start Windows Explorer</li> Double-click C:\OpenTest.xml to open the workbook in Excel.

The message box does not appear because the Open event was not raised.</li></ol>

Keywords: kbprb KB824005

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.