How to save an excel book with Microsoft.Office.Interop.Excel

mbambiambambia Member Posts: 2
I am trying to save an excel file as xlsx.
I tried to add Local:=true but the file is open but not saved (with no errors):

XlFileFormat DotNet Microsoft.Office.Interop.Excel.XlFileFormat.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
AccessMode DotNet Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
SaveConflictResolution DotNet Microsoft.Office.Interop.Excel.XlSaveConflictResolution.'Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

FileName:= 'C:\test.xlsx';
xlBook.SaveAs(FileName,XlFileFormat.xlOpenXMLWorkbook, MissingTypeValue, MissingTypeValue, false, false, AccessMode.xlNoChange, SaveConflictResolution.xlUserResolution, true, MissingTypeValue, MissingTypeValue, MissingTypeValue);

Any suggestions would be appreciated.
Thanks in advance

Answers

  • mbambiambambia Member Posts: 2
    I reply myself
    The solution is :

    xlBook.SaveAs(SaveFile,MissingTypeValue, MissingTypeValue, MissingTypeValue, MissingTypeValue, MissingTypeValue, AccessMode.xlExclusive,MissingTypeValue, MissingTypeValue, MissingTypeValue, MissingTypeValue, MissingTypeValue);
Sign In or Register to comment.