Paste Data to Sheet programatically

G

gregory

I want to be able to "Copy and Paste" one Sheet to another using th
Excel Com component for version 2000.

At the moment I have written something like the code below, but th
THEN-part doesn't work.

Here is an example:

// source_worksheet is a WorkSheet from another WorkBook that ma
contain data.

IF WorkSheetFound (workbook=myWorkBook, string sheetName=strSheetName)
THEN
{
dest_worksheet = getWorkSheet (myWorkBook, trSheetName);
//dest_worksheet is an existing WorkSheet in currentWorkBook
//Paste Source to Destination - worksheet
source_worksheet.Paste (Destination = dest_worksheet);
}

ELSE
{
//Copy whole Sheet content AFTER the destination_worksheet
dest_worksheet = getLastWorkSheet (myWorkBook);
source_worksheet.Copy (After= dest_worksheet);
}

Is there anyone who can help me solve this problem?
ThanX
 
Top