Microsoft KB Archive/179028

From BetaArchive Wiki

Article ID: 179028

Article Last Modified on 10/10/2006



APPLIES TO

  • Microsoft Excel 97 Standard Edition



This article was previously published under Q179028


SYMPTOMS

When you close a document that contains a Microsoft Excel worksheet object, the worksheet remains open in Excel.

CAUSE

This problem occurs when the following conditions are true:

  • You open an Excel workbook object that has been inserted into a document in another program (for example, Microsoft Word). -and-


  • You run a Visual Basic for Applications macro that adds a name to the Names collection of the Excel workbook.


STATUS

Microsoft has confirmed this to be a problem in Microsoft Excel 97 for Windows. This problem was corrected in Microsoft Office 97 Service Release 2 (SR-2).

For additional information about SR-2, please see the following article in the Microsoft Knowledge Base:

151261 OFF97: How to Obtain and Install MS Office 97 SR-2


MORE INFORMATION

Example of the Problem

To see an example of the problem, follow these steps:

  1. Start Excel.
  2. Start the Visual Basic Editor (press ALT+F11).
  3. On the Insert menu, click Module.
  4. Type the following code into the Visual Basic module sheet:

           Sub Test1()
    
              ActiveWorkbook.Names.Add Name:="Name1", RefersTo:="=Sheet1!a1"
    
           End Sub
                            
  5. On the File menu, click "Close and Return to Microsoft Excel."
  6. On the File menu, click Save As. Type Test.xls in the File Name box, and then click OK.
  7. On the File menu, click Exit.
  8. Start Word.
  9. On the Insert menu, click Object. Click the Create From File tab in the Object dialog box. Type Test.xls, and then click OK. Click Yes if a macro virus protection warning message appears.

    The Excel workbook is inserted into the Word document.
  10. Right-click the embedded Excel object, point to Worksheet Object on the shortcut menu, and then click Open.
  11. In Excel, Point to Macro on the Tools menu, and then click Macros. Click Test1, and then click Run.
  12. On the File menu, click "Close & Return to Document1."

The worksheet remains open in Excel.


Additional query words: vba cannot access accessing

Keywords: kbbug kbdtacode kbprogramming kbqfe KB179028