Get active excel workbook object in javascript -
currently code running is:
var excel = new activexobject("excel.application"); var excel_file = excel.workbooks.open("filepath"); var excelsheet = excel_file.activesheet; var noofsubs = excelsheet.cells(24,3).value;
excel.workbboks.open commands opens excel file. how reference open excel file? maybe
var excel_file = excel.activeworkbooks.activate("excelfilename");
typically you'd use getobject()
if there's instance of excel running , want reference that. note though if there >1 instance running, 1 can't controlled script.
https://msdn.microsoft.com/library/7tf9xwsc%28v=vs.94%29.aspx
var xl; try { // existing instance running ? xl = getobject("", "excel.application"); } catch(e) { // excel wasn't running: start new instance xl = new activexobject("excel.application"); }
Comments
Post a Comment