Microsoft KB Archive/236299

= You receive an "An error occurred while loading 'Sheet1111111111111...' " error message when you open a file in Excel 2000 =

Article ID: 236299

Article Last Modified on 6/30/2005

-

APPLIES TO


 * Microsoft Excel 2000 Standard Edition

-



This article was previously published under Q236299





SYMPTOMS
In Microsoft Excel 2000, when you try to open a file that was saved in Excel 97, you receive an error message similar to the following:

An error occurred while loading 'Sheet111111111111111111111111111'. Do you want to continue loading the project?

If you click Yes you receive the following error message

This program has performed an illegal operation and will be shut down.

with details similar to the following:

EXCEL caused an invalid page fault in module VBE6.DLL at 0167:650f6290.

If you click No you receive the error message

File not found.

and Excel does not open the file.



CAUSE
These problems occur when the following conditions are true:  In Excel 97, you copy a worksheet, adding it back to the same workbook multiple times, either manually or by using a Visual Basic for Applications macro.

-and-

 After many copies, the worksheet (Name) property in Visual Basic for Applications becomes one character longer than the limit of 31 characters.

On the final copy, this may cause the following error message

This program has performed an illegal operation and will be shut down.

with details similar to the following:

Excel has caused an invalid page fault in module EXCEL.EXE at 015f:301dd1a6.

If you have saved the file just prior to this final effort to copy a worksheet, that file may fail to open in Excel 2000.



WORKAROUND
To work around this problem, use either of the following methods.

Copy to a New Workbook
Open the problem file in Excel 97, and copy all but the sheet with the longest (Name) property to a new workbook. You can now open this workbook in Excel 2000.

Use the Microsoft Excel 97 File Recovery Macro

 * 1) Open the workbook in Microsoft Excel 97 and use the Microsoft Excel 97 File Recovery Macro to create a copy of the problem workbook.
 * 2) Open the re-created workbook in Excel 2000.

For more information about this macro, or to download this macro, go to the chapter on the Office Resource Kit at the following Microsoft Web site:

http://www.microsoft.com/office/ork/appa/appa.htm#top

Scroll down to the Microsoft Excel 97 File Recovery Macro section, and click the Download and run link to download and install the add-in.

Macro to Prevent This Problem in the Future
Microsoft 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.

To prevent this problem in the future, you can use macro code similar to the following in your Visual Basic for Applications macros. The following procedure uses the Sheets.Add method instead of the built-in ActiveSheet.Copy macro command. The procedure then copies the information from the original sheet to the newly created sheet. Because this method uses a different naming convention, it avoids the problem. Sub CreateNewSheet

Dim origSheet As Worksheet Dim newSheet As Worksheet

Set origSheet = ThisWorkbook.ActiveSheet Set newSheet = Sheets.Add ' Add a new sheet.

origSheet.Activate ' Go back to the original sheet. origSheet.UsedRange.Copy ' Copy the used range. newSheet.Activate ' Go to the new sheet. ActiveSheet.Paste ' Paste the information from the original.

End Sub



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.



MORE INFORMATION
Microsoft has changed the way Excel names a copy of a worksheet in Visual Basic for Applications. In Excel 97, when you copy a worksheet, Visual Basic for Applications gives the new worksheet a (Name) property by adding a 1 to the end of the (Name) property of the original sheet. If the (Name) property of the original sheet is "Sheet1", the (Name) property of the copied sheet becomes "Sheet11". This fails after a number of iterations, when the sheet (Name) property becomes longer than 32 characters. At this point, Excel 97 stops responding (crashes).

In Excel 2000, Visual Basic for Applications numerically increments the (Name) property, rather than adding a 1 on the end. Therefore, this problem is not likely to occur when you make multiple worksheet copies in Excel 2000.

To view the (Name) property, follow these steps:
 * 1) Press ALT+F11 to switch to the Visual Basic Editor.
 * 2) On the View menu, click Project Explorer.
 * 3) In the Project window, click the plus sign next to the VBAProject name of the workbook to expand the tree.
 * 4) Click the plus sign next to the Microsoft Excel Objects folder to see the worksheets.
 * 5) Select the last workbook on the tree.
 * 6) On the View menu, click Properties Window.
 * 7) In the Properties window, click the Alphabetic tab. View the top item which should be (Name).

Normally, you can edit this name in the box to the right.

NOTE: Editing the (Name) property after the problem has occurred does not solve the problem. If you reopen the problem file in Excel 97, switch to the Visual Basic Editor, shorten the text of the worksheet (Name) property that is longer than 31 characters, and try to save the file, Excel crashes and the save fails. Details show:

Excel has caused an invalid page fault in module Ole32.dll at 015f:7ff3da31

This same error message occurs if you delete the last worksheet copied and save the file.

