Message: ReferenceError: "ActiveXObject" is not defined in <eval> at line number 5

Document ID : KB000006909
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

I have this segment of JavaScript code 

 

var Excel; 

var fileName = "C:/NCPDP/Data/getMedOrders/MRNandTwoPrescriptionNumbers.xlsx"; 

Excel = new ActiveXObject("Excel.Application"); 

Excel.Visible = false; 

var book = Excel.Workbooks.Open(fileName); 

var sheet=book.Sheets.Item(1); 

var data=sheet.Cells(1,1).Value; 

 

testExec.setStateValue("cellValue", data); 

 

I got the following error when launch ITR 

 

============================================================================ 

| Error in Script 

============================================================================ 

| Step: Execute script (JSR-223) 

---------------------------------------------------------------------------- 

| Message: ReferenceError: "ActiveXObject" is not defined in <eval> at line number 5 

---------------------------------------------------------------------------- 

| Trapped Exception: ReferenceError: "ActiveXObject" is not defined in <eval> at line number 5 

| Trapped Message: javax.script.ScriptException: ReferenceError: "ActiveXObject" is not defined in <eval> at line number 5 

-----------

Resolution:

ActiveX is only in Internet , so this will not work in for IE browsers, ergo not work in DevTest. 

What I suggest is to post this on Communities for any suggestions. 

Here are a few links that might be helpful. 

"http://codetheory.in/parse-read-excel-files-xls-xlsx-javascript/" 

"http://psjinx.com/programming/2014/01/04/parsing-excel-workbooks-using-javascript/"