Microsoft KB Archive/825959

= BUG: Excel does not quit if an embedded workbook has a Smart Document attached =

Article ID: 825959

Article Last Modified on 2/5/2007

-

APPLIES TO


 * Microsoft Office Excel 2007
 * Microsoft Office Excel 2003

-





SYMPTOMS
When you have a Microsoft Office Excel 2003 or Microsoft Office Excel 2007 workbook with an attached Microsoft Office 2003 Smart Document and you open that Excel workbook inside an OLE container or inside an ActiveX Document container, Excel does not quit when you move away from the workbook or when you close the container. The Excel application process remains in the Task list and holds a lock on the workbook that you previously opened.



CAUSE
This problem may occur for the following reasons:
 * You store a reference to the Excel workbook as a public variable.
 * You store a reference to the Excel workbook as a variable that is scoped to your class that implements the ISmartDocument interface.



STATUS
Microsoft has confirmed that this is a bug in Microsoft Office Excel 2003. Microsoft has confirmed that this is a bug in Microsoft Office Excel 2007.



Steps to Reproduce the Problem
The following steps use the SimpleSampleVB6 sample that is installed with the Office 2003 Smart Document software development kit (SDK). To make sure that the following steps work correctly, you must install the SDK at  on your computer.  Modify the SimpleSampleVB6 Smart Document:  In Microsoft Windows Explorer, move to \Samples\SimpleSampleVB6, and then double-click SimpleSample.vbp to open it in Microsoft Visual Basic 6.0.  In the clsActions class module, add a class level Excel Workbook variable as follows: Private oBook as Excel.Workbook   Locate the following ISmartDocument_SmartDocInitialize method in the code: strPath = Document.Path & &quot;\&quot; strApp = Document.Application.Name Change the ISmartDocument_SmartDocInitialize method to the following code: strPath = Document.Path & &quot;\&quot; strApp = Document.Application.Name Set oBook = Document Save your changes to the project.  On the File menu, click Make SimpleSample.dll to recompile the library. If you are prompted to overwrite the existing file, click Yes.</ol> </li> In Windows Explorer, move to \Samples\SimpleSampleVB6. Right-click SimpleSample.xls, point to Open With, and then click Internet Explorer. If the File Download dialog box appears in Microsoft Internet Explorer, click Open.</li> Close Internet Explorer.</li> Start Microsoft Windows Task Manager.

Notice that the instance of Excel still appears in the Processes list.</li> In Windows Explorer, move to \Samples\SimpleSampleVB6, and then double-click SimpleSample.xls.

You receive a message that says that SimpleSample.xls is already open.</li></ol>

<div class="references_section">