Hi,
I am using the following code to save my work into workbook and closing it after saving my data into it
object misValue = System.Reflection.Missing.Value;
Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkBook = xlApp.Workbooks.Add(misValue);
Excel._Worksheet xlWorksheet1 = xlWorkBook.Sheets[1];
List<DataSet> lstDS1 = new List<DataSet>();
lstDS1 = GetExcelData(@"\\global.scd.scania.com\home\se\121\valhbc\Desktop\log file data\Output\", "ResponseTime.xls");
string path1 = Properties.Settings.Default.OutputDirPath + "\\" + "GatewayMsgs.xls";
if (File.Exists(path1))
File.Delete(path1);
xlWorkBook.SaveAs(path1, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlShared, misValue, misValue, misValue, misValue, misValue);
xlWorkBook.Close(true, misValue, misValue);
}
}
But when I am trying to open the workbook in output folder,another empty workbook is also opening with my saved workbook and every time the workbook number is incresing like(Book1,Book2,Book3 etc)
Can anyone please suggest me some olution to solve this problem
Thanks
John