ID: Q176242
The information in this article applies to:
When you active a Microsoft Excel worksheet object and then click "Close & Return to <Document>," where <Document> is the name of the document that contains the Microsoft Excel worksheet object, you may receive an error message that is similar to one of the following.
This program has performed an illegal operation and will be
shut down. If the problem persists, contact the program vendor.
If you click Details, you may receive an error message similar to the
following:
Excel caused an invalid page fault in module Excel.exe at
015f:3005a618.
Dr. Watson for Windows NT
An application error has occurred and an application error log is
being generated.
Excel.exe
Exception: access violation (0xc0000005), Address 0x3005a618.
This problem may occur if the following conditions are true:
-and-
-and-
-and-
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:
ARTICLE-ID: Q151261
TITLE : OFF97: How to Obtain and Install MS Office 97 SR-2
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/supportnet/refguide/
To see an example of this problem, follow these steps.
1. Start Excel.
2. If you do not have a Personal Macro Workbook (Personal.xls), create
one; otherwise, proceed to step 3 if you already have a Personal Macro
Workbook. To create this workbook, follow these steps:
a. On the Tools menu, point to Macro, and then click Record New Macro.
b. Click Personal Macro Workbook in the Store Macro In list, and then
click OK.
c. On the Tools menu, point to Macro, and then click Stop Recording.
3. Start the Visual Basic Editor (press ALT+F11).
4. Press CTRL+R to switch to the Project Explorer Window.
5. In the Project Explorer window, click to select VBAProject
(PERSONAL.XLS).
6. On the Insert menu, click Class Module to insert a Class module.
7. Type the following code into the class module:
Public WithEvents App As Application
Private Sub App_WorkbookBeforeClose(ByVal Wb As Excel.Workbook, _
Cancel As Boolean)
MsgBox "App_WorkbookBeforeClose"
End Sub
8. In the Project Explorer window of Visual Basic Editor, double-click
ThisWorkbook in the current project.
9. Type the following code into the ThisWorkbook module sheet.
Dim X As New Class1
Private Sub Workbook_Open()
Set X.App = Application
End Sub
10. On the File menu, click "Close and Return to Microsoft Excel."
11. Click Exit on the File menu. Click Yes when you are prompted to save
the changes in the Personal Macro Workbook.
To insert the Excel objects, follow these steps:
1. Start Word.
2. On the Insert menu, click Object. Click Microsoft Excel Worksheet in
the Object Type list, and then click OK.
An Excel worksheet object is inserted into your document.
3. Click the Word document to switch to Word.
4. On the Insert menu, click Object. Click Microsoft Excel Worksheet in
the Object Type list, and then click OK.
An Excel worksheet object is inserted into your document.
5. Click the Word document to switch to Word.
6. Right-click the first embedded Excel object, point to Worksheet
Object on the shortcut menu, and then click Open.
7. Switch to Word.
8. Right-click the second embedded Excel object, point to Worksheet
Object on the shortcut menu, and then click Open.
9. Type the following formula into cell A1 of the "Worksheet in Document1
2" workbook, and then press ENTER:
='[Worksheet in Document3]Sheet1'!$A$1
10. On the File menu, click "Close & Return to Document1."
You may receive an error message that is similar the messages described in the "Symptoms" section in this article.
Additional query words:
Keywords : kberrmsg kbole kbdta
Issue type : kbbug
Solution Type : kbfix
Last Reviewed: May 17, 1999