2
votes

I encountered a strange error in an Excel 2007 add-in that seems to be reproducible with a few lines of macro code (Update: even without code, see below).

Open a new workbook and add the following code to the first worksheet.

Private Sub Worksheet_Change(ByVal Target As Range)
    Application.DisplayAlerts = False ' Suppress macro and overwrite warnings
    ActiveWorkbook.SaveAs "test.xml", XlFileFormat.xlXMLSpreadsheet
End Sub

Now each change will save the workbook as an XML spreadsheet file.

However, when I open a second instance of Excel and copy a single cell from there to the auto-saving workbook Excel 2007 crashes. (I have also seen an RPC_E_SERVERFAULT error in a comparable situation.) In Excel 2010 the file is saved as expected.

Any ideas what might be the root cause for this behaviour and how to avoid it?

UPDATE

Seems like it's even worse: If I copy data from one Excel (2007) instance to another and save the target workbook as XML spreadsheet Excel crashes. I tried this on two machines, so is this a known bug?