在IE中調用javascript開啟Excel(downmoon原作)
關鍵詞: javascript調用excel
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<TITLE>Top30銷控表</TITLE>
</HEAD>
<BODY>
<input name="shanghai" type="button" class="but" id="shanghai" onClick="StartExcel('上海')" value="上海店">
<SCRIPT LANGUAGE="Javascript">...
var idTmr = "";
function StartExcel(strFileName)
...{
var oExcel;
var oWorkbook;
var strAllName;
oExcel = new ActiveXObject("Excel.Application");
//if(strFileName=null || strFileName="")
//{return;
//}
strAllName="\\ep-hgh\Top30銷控表\TOP30招商續約銷控表-"+strFileName+".xls";
oExcel.Workbooks.Open(strAllName);
//oExcel.Workbooks.Open("file://ep-hgh/Top30銷控表/TOP30招商續約銷控表-上海.xls");
oExcel.DisplayAlerts = false;
oExcel.Visible = true;
//oExcel.Quit();
//oExcel = null;
//防EExcel死進程的關鍵!!必須!!!downmoon嚴重聲明
idTmr = window.setInterval("Cleanup();",1000);
}
function Cleanup() ...{
window.clearInterval(idTmr);
CollectGarbage();
}
</SCRIPT>
</BODY>
</HTML>