PRB: Workbook Open Event Is Not Raised for Managed Code Extensions (824005)



The information in this article 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 "Supported Document Formats for Managed Code Extensions," in the topic "Architecture of Office Solutions That Use Managed Code Extensions," 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

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

      The Microsoft Office Project Wizard appears.
    5. Click Finish.
  2. Add the following line of code to the ThisWorkbook_Open event procedure:
    MessageBox.Show("This is the Open event.")
  3. On the Build menu, click Build Solution.
  4. Start Windows Explorer.
  5. Double-click C:\OpenTest\OpenTest.xls to open the workbook in Excel.

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

    The message box does not appear because the Open event was not raised.

Modification Type:MinorLast Reviewed:2/3/2006
Keywords:kbprb KB824005 kbAudDeveloper