System.Reflection.Missing miss = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.ApplicationClass();
Microsoft.Office.Interop.Excel.Workbooks books = (Microsoft.Office.Interop.Excel.Workbooks)excel.Workbooks;
// Microsoft.Office.Interop.Excel.Workbook book = (Microsoft.Office.Interop.Excel.Workbook)(books.Add(miss));
Microsoft.Office.Interop.Excel.Workbook book = books.Add(XlWBATemplate.xlWBATWorksheet);
for (int i = 1; i < 6; i++)
{
// Microsoft.Office.Interop.Excel.Worksheet sheet = (Microsoft.Office.Interop.Excel.Worksheet)book.ActiveSheet;
Microsoft.Office.Interop.Excel.Worksheet newWorksheet;
newWorksheet = (Microsoft.Office.Interop.Excel.Worksheet)book.Worksheets.Add(miss, miss, miss, miss);
newWorksheet.Name = "test" + i.ToString();
}
excel.Visible = true;