Knowledge base KB0062

Error message in Excel: "Errors were detected while saving ..."

Problem

Consider the following scenario: You are working on a project to automate Microsoft Office. Therefore, you have opened the Microsoft Visual Basic for Applications editor. An Excel worksheet is open as well, which contains a think-cell Excel data link (see 21. Excel data links).

You delete the Excel worksheet where think-cell's Excel data link resides. Excel may show an error message: "Object required".

If you try to save the Excel file, Excel shows an error message:
"Errors were detected while saving [file name]. Microsoft Excel may be able to save the file by removing or repairing some features. To make the repairs in a new file, click Continue. To cancel saving the file, click Cancel."

Excel error message: Errors were detected while saving.

When you click Continue, the repair fails.

Excel 2007 or 2010: Excel crashes if you try to insert a new Excel worksheet instead of trying to save the file.

Cause

The problem is caused by a bug in Excel. We have filed a case with Microsoft. If your company has a Microsoft Office Support contract and you want to contact Microsoft to ask for a fix, you may refer to Microsoft case number 114072911657591. The error can be reproduced without think-cell.

Reproduction without think-cell

Please perform the following steps:

  1. Start Excel with a new empty file.
  2. Enter 100 in cells A1 and A2 on the first worksheet, Sheet1.
  3. Select the cells A1:A2 on Sheet1 and press Ctrl + C to copy.
  4. (Only if you try to reproduce with Excel 2013 or later: Insert a second worksheet. Older Excel versions have three default worksheets, so this is not required).
  5. Press Alt + F11 to open the Microsoft Visual Basic for Applications editor window, and leave it open.
  6. Start Word with a new empty file.
  7. In Word, go to HomePastePaste SpecialPaste Link: Microsoft Excel Worksheet Object and click OK.
  8. In Excel, right-click the Sheet1 tab and click Delete.
  9. Try to save the Excel file. Excel shows an error message:
    "Errors were detected while saving [file name]. Microsoft Excel may be able to save the file by removing or repairing some features. To make the repairs in a new file, click Continue. To cancel saving the file, click Cancel."

    When you click Continue, the repair fails.

    Excel 2007 or 2010: Excel crashes if you try to insert a new Excel worksheet instead of trying to save the file.

Solution

If you encounter this error, you can save your data in a new Excel document or discard the changes and repair the original document:

Save your data in a new Excel document

To save changes you made to your document, copy the worksheets you changed to a new Excel document and save it.

Repair your Excel document to avoid this error in the future

You can repair your Excel document by deleting any Visual Basic for Applications (VBA) projects from your document. However, simply deleting them in the Visual Basic editor is not sufficient. Please use the following procedure:

  1. Create a backup of your document.
  2. Download and run the free Structured Storage Viewer.
  3. Open your document in the Structured Storage Viewer.
  4. In the tree view of your document, select _VBA_PROJECT_CUR and press Del to delete it.
  5. Confirm deletion and close the Structured Storage Viewer.
  6. Open the document in Excel.
  7. There will be a dialog box Microsoft Visual BasicFile not found. Hit OK.
  8. There will be another dialog box Repairs, with Lost Visual Basic project listed. Hit Close.
  9. Save your document.

You should now be able to delete the worksheet with think-cell links and then save the document.

Share