Article ID: 158997 - Last Review: October 11, 2006 - Revision: 2.2 XL97: Error When Variable Refers to Deleted or Moved SheetThis article was previously published under Q158997 On This PageSYMPTOMS
When you run a Visual Basic for Applications macro in Microsoft Excel 97,
you may receive one of the following error messages:
Run-time error '-2147221080 (800401a8)': Automation error
-or-
Run-time error '-2147221080 (800401a8)': Method 'Name' of object '_Worksheet' failed
-or-
Run-time error '424': Object required
This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor.
EXCEL caused an invalid page fault in module VBA332.DLL at 014f:651b5717. CAUSE
This problem occurs when all of the following conditions are true:
WORKAROUNDMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers 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 requirements.
The following macro moves Sheet1 from the active workbook into a new
workbook:
Method 1: Set the Variable to Point to the New Location of the WorksheetMethod 2: Set XSheet Equal to NothingSTATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. This problem no longer occurs in
Microsoft Excel 2000.
MORE INFORMATION
In earlier versions of Microsoft Excel, if you create a variable that
refers to a sheet, and then move that sheet to another workbook, the
variable continues to find to the sheet in its new location. For example if
you run the following subroutine in Microsoft Excel 5.0 or 7.0, the MsgBox
displays the name of the moved sheet ("Sheet1 (2)") even when you move the
worksheet to a different workbook:
| Article Translations
|

Back to the top
