ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to create new sheet in excel using VJ#.Net (https://www.excelbanter.com/excel-programming/305686-how-create-new-sheet-excel-using-vj-net.html)

tony

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






All times are GMT +1. The time now is 12:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com