Jack Miller Jack Miller - 7 months ago 98
C# Question

No xlOpenXMLWorkbook in interop

I have some code that is trying to convert a .xls spreadsheet into a .xlsx spreadsheet using Interop:

public void Convert(string file)

var app = new Microsoft.Office.Interop.Excel.Application();
var wb = app.Workbooks.Open(file);
wb.SaveAs(Filename: file + "x", FileFormat: Microsoft.Office.Interop.Excel.XlFileFormat.xlOpenXMLWorkbook);

However I am receiving an error which says that
xlopenxmlworkbook' is not a member of 'microsoft.office.interop.excel.xlfileformat'

Which leads me to beileive that I cannot save a .xls file because its a Excel 2003 file and .xlsx isn't supported by Excel 2003?

I have Office 2013 installed, so should not be a problem.

Is there a way to add xlopenxmlworkbook to the dll or update it? or another workaround?


Just use the numeric value of xlOpenXMLWorkbook, which is 51.