View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tony tony is offline
external usenet poster
 
Posts: 313
Default How to create new sheet in excel using VJ#.Net

Hi,
I need a code to create a new sheet in the visual j sharp. i tried using this code but it does not work.
//Using Excel 9.0 Object library
import Excel.*;

Excel.ApplicationClass xlApp = new Excel.ApplicationClass();
Workbooks books = (Workbook)xlApp.get_Workbooks();
//Adding excel Template
_Workbook book = (_Workbook)books.Add(Excel.Xlsheet.xlWorksheet);
Sheets sheets = (Sheets)book.get_Worksheets();

//Now trying to add sheet
//Here add method takes .Add(Object before,Object after,Object Count, Object Type)
//
Sheets.Add(null,null,null,null);


Could anyone tell me what i need to do to add sheet?

thanks in advance.
Tony