Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How To make a sheet reference Variable (eq: sum(sheet!D2:H2)) | Excel Discussion (Misc queries) | |||
Copy sheet and make new sheet active | Excel Discussion (Misc queries) | |||
can I make a specified sheet as startup sheet in a workbook? | Excel Discussion (Misc queries) | |||
Excel worksheet - Can I make changes in one sheet affect contents of other sheet? | Excel Discussion (Misc queries) | |||
unprotect sheet in code and make sheet visible | Excel Programming |