var xlApp, xlWB, xlSheet,f2,fso,oBook,oSheet,oBook1,oSheet1,idTmr;
xlApp = new ActiveXObject("Excel.Application");
fso = new ActiveXObject("Scripting.FileSystemObject");
if(fso.FileExists("c:\\Example.XLS"))
{
f2=fso.GetFile("c:\\Example.XLS");
f2.Delete();
}
xlApp.Visible = true;
xlApp.DisplayAlerts=false
xlWB = xlApp.Workbooks.Add();
xlWB.Sheets.Add(null,xlWB.Sheets(xlWB.Sheets.Count));
xlWB.WorkSheets(1).Name="Redmond_Enabled";
xlWB.WorkSheets(2).Name="Redmond_Disabled";
xlWB.WorkSheets(3).Name="PHX_Enabled";
xlWB.WorkSheets(4).Name="PHX_Disabled";
xlSheet = xlWB.WorkSheets(1);
xlSheet.Activate();
xlSheet.Cells(1,1).Value = "job name";
xlSheet.Cells(1,2).Value = "job ID";
xlSheet.Cells(2,1).Value = "a";
xlSheet.Cells(2,2).Value = "a1";
xlSheet.Cells(3,1).Value = "b";
xlSheet.Cells(3,2).Value = "b1";
xlSheet.Cells(4,1).Value = "c";
xlSheet.Cells(4,2).Value = "c1";
xlSheet = xlWB.WorkSheets(2);
xlSheet.Activate();
xlSheet.Cells(1,1).Value = "job name";
xlSheet.Cells(1,2).Value = "job ID";
xlSheet.Cells(2,1).Value = "a";
xlSheet.Cells(2,2).Value = "a1";
xlSheet.Cells(3,1).Value = "b";
xlSheet.Cells(3,2).Value = "b1";
xlSheet.Cells(4,1).Value = "c";
xlSheet.Cells(4,2).Value = "c1";
var oExcelApp = new ActiveXObject("Excel.Application");
var oWkBks = oExcelApp.Workbooks;
oWkBks.open("c:\\Example_PHX.xlsx");
oBook = oWkBks.Item(1);
oSheet = oBook.Worksheets.Item(1);
oSheet.Activate();
oSheet.Cells.Select();
oExcelApp.Selection.Copy();
xlSheet = xlWB.WorkSheets(3);
xlSheet.Activate();
xlSheet.Paste();
oBook = oWkBks.Item(2);
oSheet = oBook.Worksheets.Item(2);
oSheet.Activate();
oSheet.Cells.Select();
oExcelApp.Selection.Copy();
xlSheet = xlWB.WorkSheets(4);
xlSheet.Activate();
xlSheet.Paste();
xlSheet.SaveAS("C:\\Example.XLSx");
xlApp.Quit();
xlApp = null;
CollectGarbage(1500);
After copying 1st worksheet to the 3rd worksheet,it throws Exception..Please suggest where I
am doing wrong...Is there any problmem of garbage collector
Please reply me to adityamandlekar@yahoo.com or v-admand@microsoft.com if possible..its
urgent!!!