XL97: Excel Object Is Not Closed After Running Macro
ID: Q179028
|
The information in this article applies to:
-
Microsoft Excel 97 for Windows
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:
Q151261 OFF97: How to Obtain and Install MS Office 97 SR-2
MORE INFORMATIONExample of the Problem
To see an example of the problem, follow these steps:
- Start Excel.
- Start the Visual Basic Editor (press ALT+F11).
- On the Insert menu, click Module.
- Type the following code into the Visual Basic module sheet:
Sub Test1()
ActiveWorkbook.Names.Add Name:="Name1", RefersTo:="=Sheet1!a1"
End Sub
- On the File menu, click "Close and Return to Microsoft Excel."
- On the File menu, click Save As. Type Test.xls in the File Name box, and then click OK.
- On the File menu, click Exit.
- Start Word.
- 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.
- Right-click the embedded Excel object, point to Worksheet Object on the
shortcut menu, and then click Open.
- In Excel, Point to Macro on the Tools menu, and then click Macros.
Click Test1, and then click Run.
- On the File menu, click "Close & Return to Document1."
The worksheet remains open in Excel.
Additional query words:
vba cannot access accessing
Keywords : kbprg kbdta xlvbainfo
Version : WINDOWS:
Platform : WINDOWS
Issue type : kbbug
|