I am trying to open an Excel file, refresh the query behind it and then save and close the file in C#.
I have the following but I am getting errors on the following line first up:
object _missingValue = System.Reflection.Missing.Value;
Application excel = new Application();
Workbook theWorkbook = excelFile.Workbooks._Open(txtLocation.Text, _missingValue, _missingValue, _missingValue, _missingValue, _missingValue, _missingValue, _missingValue, _missingValue, _missingValue, _missingValue, _missingValue, _missingValue);
Sheets sheets = (Sheets)theWorkbook.Worksheets;
theWorkbook.RefreshAll();
theWorkbook.Save();
excel.Quit();
I have added the Microsoft.Office.Interop.Excel reference, but still have the issue, what I am missing?