Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

XL2000: Invalid Page Fault Opening Workbook Sent in E-mail


View products that this article applies to.

This article was previously published under Q211367

↑ Back to the top


Symptoms

When you open a workbook in e-mail or save the attachment and open the workbook in Microsoft Excel, you may receive the following error message:
This program has performed an illegal operation and will be shut down.
If the problem persists, contact the program vendor.
When you click Details, you receive an error message similar to the following:
Excel.exe caused an invalid page fault in module Excel.exe at 015f:3047004d.

↑ Back to the top


Cause

This problem occurs when you do the following:

Run a macro that uses the Delete method.

-and-
The macro sends the workbook via e-mail by using either of the following methods:
   Application.Dialogs(xlDialogSendMail)

   -or-

   Activeworkbook.SendMail
							

↑ Back to the top


Workaround

Use either of the following methods to work around this problem.

Method 1: Use Two, Separate Macros

In order to use the Delete method and the SendMail property, you can use two separate macro subroutines. However, you would run each macro individually. In the following example, you would first run Sub DelSheet, and then, when it is finished, you would run Sub SendEmail.
   Sub DelSheet()
      Sheet2.Delete
   End Sub

   Sub SendEmail()
      ActiveWorkbook.SendMail ""
   End Sub
				

Method 2: Use the OnTime Method

To use both the Delete method and SendMail property in the same macro subroutine, you can use the OnTime method. The OnTime method runs a specified macro at a specified time interval. By using this method, you can delete a worksheet and wait N seconds before sending the e-mail, where N represents the number of seconds to wait. The example below waits 5 seconds before running the SendEmail macro procedure:
   Sub DelSheet()
      Sheet2.Delete
      Application.OnTime Now + TimeValue("0:0:05"), "SendEmail"
   End Sub

   Sub SendEmail()
      ActiveWorkbook.SendMail ""
   End Sub
				

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


Keywords: KB211367, kbpending, kbbug

↑ Back to the top

Article Info
Article ID : 211367
Revision : 3
Created on : 10/6/2003
Published on : 10/6/2003
Exists online : False
Views : 258