請高手指教,謝謝~~
代碼如下:
該功能無法實現--無法將表格的數據粘貼到Excel文件對應的位置
var idTmr = "";
function CellToTable(tableID)
{
try
{
var sel=document.body.createTextRange();
sel.moveToElementText(tableID);
sel.select();
sel.execCommand("Copy"); var exApp = new ActiveXObject("Excel.Application");
exApp.DisplayAlerts=false;
exApp.Visible=true;
var oWB=exApp.WorkBooks.Open("D:\EATD_report\manager\MSL DVSC EATD WR1.xls"); // var oWB = exApp.WorkBooks.add();
var exSheet = oWB.WorkSheets(1).range("A19");
exSheet.Paste(); exApp.SaveAs("D:\EATD_report\manager\MSL DVSC EATD WR.xls");
exApp.Quit();
exApp = null;
idTmr = window.setInterval("Cleanup();",10);
}catch(Exception)
{
}
}
function Cleanup()
{
window.clearInterval(idTmr);
CollectGarbage();
}
代碼如下:
該功能無法實現--無法將表格的數據粘貼到Excel文件對應的位置
var idTmr = "";
function CellToTable(tableID)
{
try
{
var sel=document.body.createTextRange();
sel.moveToElementText(tableID);
sel.select();
sel.execCommand("Copy"); var exApp = new ActiveXObject("Excel.Application");
exApp.DisplayAlerts=false;
exApp.Visible=true;
var oWB=exApp.WorkBooks.Open("D:\EATD_report\manager\MSL DVSC EATD WR1.xls"); // var oWB = exApp.WorkBooks.add();
var exSheet = oWB.WorkSheets(1).range("A19");
exSheet.Paste(); exApp.SaveAs("D:\EATD_report\manager\MSL DVSC EATD WR.xls");
exApp.Quit();
exApp = null;
idTmr = window.setInterval("Cleanup();",10);
}catch(Exception)
{
}
}
function Cleanup()
{
window.clearInterval(idTmr);
CollectGarbage();
}
上面我是以 D:\EATD_report\manager\MSL DVSC EATD WR1.xls為模板~~