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

ID: Q211367


The information in this article applies to:
  • Microsoft Excel 2000


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.


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 



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 


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

Additional query words: mapi OFF2000 XL2000

Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: May 13, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.