Is there a way to automatically detect the excel version from a html file or active x?
I have a workflow process that runs in weird combination of html and excel, this was already done when I came to work here so I'm no able to restart the process, well here is the deal: After a certain step on the flow, a html file is sent through email, this file contains an active x that will automatically open excel with some given parameters, however even though everything seems to build with parameters the path for excel is hardcoded, we never had an issue with this as everyone was using Excel 2003 and pretty much everyone had the same image so the path was the same, but now some users (top management) will be migrating to office 2010. Therefore I need a way to automatically detect the excel version through the active x so the html file will open the correct excel version.
Any ideas?
Thanks!
EDIT this is what I use:
<script language="JavaScript">
function LoadVendor()
{
var vendor = document.getElementById("vendor").value;
document.getElementById("vend").innerHTML=vendor;
var BIDnum = document.getElementById("BIDnumber").value;
document.getElementById("BIDnum").innerHTML=BIDnum;
}
function openExcelDocPath()
{
var shell = new ActiveXObject("WScript.Shell");
var excelexe = document.getElementById("excelexe").value;
var excelprg = document.getElementById("excelprg").value;
var vendor = document.getElementById("vendor").value;
document.getElementById("vend").innerHTML开发者_如何学编程=vendor;
shell.run( "\"" + excelexe + "\"" + excelprg , 1, false );
try{objExcel.comaddins("SAS.OIBootStrap.Connect").connect = "False"; }
catch(err)
{ }
}
</script>
I'm not 100% on what your after but you could drop the physical path entirely;
var Excel = new ActiveXObject("excel.application");
Excel.Visible = true;
Excel.Workbooks.Add(); //to keep resident if you want interactivity
//can open something here ...
//or just get the path/version
alert( Excel.version );
alert( Excel.path );
//to kill
//Excel.Quit();
//Excel = null;
精彩评论