Hi all,
I have a problem creating an Excel file from C# Code with Microsoft.office.interop.excel.dll.
The Code where the Exception occurs is:
workbook.SaveAs(filename, missing, missing, missing, missing, missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, missing,
missing, missing, missing, missing);
and the Error Message is:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout, Object Local) at ExcelInOut.ExcelExIm.CreateExcelSheet(DataTable dt, String directory) inS:\CGM Software\Projekte\ImosTranslator\Code\ITranslator\ExcelInOut\ExcelExIm.cs:line 86
My problem is on my machine (WinXP, Visual Studio 2005 Pro, .Net 2.0 with all updates) the Code works fine, no Error
occurs. But on the target machine Win2003 Server with the latest service packs and updates (with .NET 2.0) this happens.
Do anybody have some suggestions?
Thanks for answers
CM
I have a problem creating an Excel file from C# Code with Microsoft.office.interop.excel.dll.
The Code where the Exception occurs is:
workbook.SaveAs(filename, missing, missing, missing, missing, missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, missing,
missing, missing, missing, missing);
and the Error Message is:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout, Object Local) at ExcelInOut.ExcelExIm.CreateExcelSheet(DataTable dt, String directory) inS:\CGM Software\Projekte\ImosTranslator\Code\ITranslator\ExcelInOut\ExcelExIm.cs:line 86
My problem is on my machine (WinXP, Visual Studio 2005 Pro, .Net 2.0 with all updates) the Code works fine, no Error
occurs. But on the target machine Win2003 Server with the latest service packs and updates (with .NET 2.0) this happens.
Do anybody have some suggestions?
Thanks for answers
CM