Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How to spool through worksheets in a workbook

I am copying a template worksheet in excel many times within a foreach
loop using c#.
I then need to move to the first worksheet I copied to populate it
brfore moving onto the next sheet.
Does anyone have some code on this. I would appreciate your help on
this thanks.
Cyril

Code he
// spool thro the tables extracting the base currency
// as we need to create a new sheet for every base
currency returned.
int _workSheetIdx = 1;

Excel.Sheets sheets = this.Worksheets;
Excel.Worksheet _wsTemplate =
(Excel.Worksheet)Sheets.get_Item(_workSheetIdx);
_wsTemplate.Name = "Template";

foreach (System.Data.DataTable dtBc in ds.Tables)
{
_wsTemplate.Copy(Type.Missing, _wsTemplate);

_workSheetIdx++;

_wsTemplate =
(Excel.Worksheet)this.Sheets[_workSheetIdx];
_wsTemplate.Name =
dtBc.Rows[0]["BaseCurrencyCode"].ToString();

PopulateCurrentWorkSheet(dtBc, _wsTemplate);
}

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
Combine worksheets in multiple workbook in one workbook with a macro Sam Commar Excel Discussion (Misc queries) 2 April 2nd 09 01:09 PM
copying worksheets to a new workbook without formulae referencing original workbook [email protected] Excel Programming 2 October 16th 06 07:31 PM
xls spool file doesn't automatically link to new xls file zimon72 Excel Discussion (Misc queries) 0 January 19th 06 08:23 AM
Copy four worksheets from one workbook into a new workbook.e-mail Francis Brown Excel Programming 1 October 3rd 05 12:24 AM
Link multiple worksheets in one workbook to another workbook and . HeatherCarr Excel Programming 0 March 28th 05 10:35 PM


All times are GMT +1. The time now is 09:07 PM.

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

About Us

"It's about Microsoft Excel"