ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet.Copy( @parameter1, @NextWorksheetinArray) (https://www.excelbanter.com/excel-programming/377419-worksheet-copy-%40parameter1-%40nextworksheetinarray.html)

Cyril[_3_]

Worksheet.Copy( @parameter1, @NextWorksheetinArray)
 
hello all,

I am copying a template worksheet in code for a number of base
currencies returned from my datatable. I would like to copy the
template just but have to iterate so i end up copying the previous
sheet. can anyone help me on this. heres the code
thanks
Cyril

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);
}



All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com