Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To make a sheet reference Variable (eq: sum(sheet!D2:H2)) John Linker Excel Discussion (Misc queries) 3 June 16th 08 11:29 PM
Copy sheet and make new sheet active belvy123 Excel Discussion (Misc queries) 5 April 24th 08 03:33 PM
can I make a specified sheet as startup sheet in a workbook? Arup C[_2_] Excel Discussion (Misc queries) 4 October 12th 07 01:56 PM
Excel worksheet - Can I make changes in one sheet affect contents of other sheet? [email protected] Excel Discussion (Misc queries) 3 July 11th 06 03:34 PM
unprotect sheet in code and make sheet visible peach255 Excel Programming 1 August 1st 03 03:28 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"