![]() |
How to make a nex sheet?
I´m writing a C-program that collects data and presentate it in new file which i want to open in Excel
What do i write in my new file, so the data will be presentated in different sheets in the same worksheet How do I make a new sheet? |
How to make a nex sheet?
I presume you are not talking C#.
Here is some code to add a sheet. Forgive the code if any problems, C++ is not my language, but I am sure you will be able to correct any errors. The new sheet goes before the selected sheet, but you can specify the Before position. // Convenient variables. COleVariant covTrue((short)TRUE), covFalse((short)FALSE), covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); _Application oApp; _Workbook oBook; Workbooks oBooks; _Workbook oHTML; Sheets oSheets; _Worksheet oSheet; oApp.CreateDispatch("Excel.Application"); oApp.SetVisible(TRUE); oBooks = oApp.GetWorkbooks(); oBook = oBooks.Add(covOptional); oSheets = oBook.GetSheets(); // Now add a worksheet. If "before" and "after" are omitted, // worksheet is // added before all other worksheets. oSheet = oSheets.Add(covOptional, covOptional, covOptional, covOptional); oSheet.SetName("MyNewSheetBefore"); -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Cedrix" wrote in message ... I´m writing a C-program that collects data and presentate it in new file which i want to open in Excel. What do i write in my new file, so the data will be presentated in different sheets in the same worksheet? How do I make a new sheet? |
All times are GMT +1. The time now is 05:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com