Private _ workbook = null;
Private worksheet _ worksheet = null;
Private excel. application _ excelapplicatin = null;
_ Excelapplicatin = new excel. application ();
_ Excelapplicatin. visible = true;
_ Excelapplicatin. displayalerts = true;
_ Workbook = _ excelapplicatin. workbooks. add (xlsheettype. xlworksheet );
_ Worksheet = (worksheet) _ workbook. activesheet;
_ Worksheet. name = "worksheetname ";
// Open an existing excel File
String strexcelpathname = appdomain. currentdomain. basedirectory + "excelsheetname.xls ";
Excel. workbook = application. workbooks. open (strexcelpathname, type. missing, type. missing,
Type. missing,
Type. missing, type. missing );
// Read the opened excel File
Excel. worksheet worksheet1 = (excel. worksheet) workbook. sheets ["sheetname1"];
Excel. worksheet worksheet2 = (excel. worksheet) workbook. sheets ["sheetname2"];
// Add a worksheet
Worksheet = (worksheet) workbook. worksheets. add (system. type. missing, system. type. missing );
1 2