How to generate excel files with multiple sheets?

P

Pedro Martins

I'm generating an excel file using the OWC, on the server side. I need to
create an excel file with more than one sheet. Here's the code (C#) I've
tried:

currentSheet.Sheets.Add( Missing.Value, Missing.Value, 1,
XlSheetType.xlWorksheet );

This doesn't produce any results. Is there any working method of doing this?

Thanks in advance,
Pedro
 
R

rweide

I use this to add worksheet after each sheet:
SS1.Worksheets.Add SS1.Worksheets(SS1.Worksheets.Count),,1
And, I use (VBScript) this to populate each sheet:
With SS1.ActiveSheet
.Cells.copyFromRecordset adoRS
.Range("A2").Select
Wend
And depending on how you get the resultsets, you need to add these to your
loop.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top