No overload for method 'Open' takes '13' arguments
I’m trying to open an XLS file and then read some cell values. It doesn’t work, and I’m a little puzzled. When I try to compile the application it tells me the following message:
No overload for method 'Open' takes '13' arguments
However, I have checked the method and it seems that there are fifteen variables to parse in the method, but I don’t know what the other missing two are. Indeed, I am using an example posted on the Internet but it doesn’t even compile.
Excel.Application ExcelObj = new Excel.Application();
ExcelObj.Visible = true;
openFileDialog1.FileName = "test.xls";
// *********** Here is the call to Open a Workbook in Excel ****************
Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open(
openFileDialog1.FileName, 0, false, 5,
"", "", true, Excel.XlPlatform.xlWindows, "\t",
false, false, 0, true);
// get the collection of sheets in the workbook
Excel.Sheets sheets = theWorkbook.Worksheets;
// get the first and only worksheet from the collection
// of worksheets
Excel.Worksheet worksheet = (Excel.Worksheet)sheets.get_Item(1);