我试图打开一个Excel文件,刷新其背后的查询,然后保存并关闭C#中的文件。
我有以下的,但我第一次上以下行收到错误了:
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();
我已经添加了的Microsoft.Office.Interop.Excel引用,但仍然有问题,我很想念?