Forum Discussion

harshadw's avatar
harshadw
New Contributor
7 years ago

How to resolve the error while opening an excel workbook?

I am trying to open an excel workbook using the below lines of code. It throws an error saying,

 

function Test(){
var Excel;
Excel = Sys.OleObject("Excel.Application");
Excel.Visible = true;
Excel.Workbooks.Open("‪D:\\test1.xls");

}

 

"Sorry, we couldn't find D:\test1.xls. Is it possible it was moved, renamed or deleted?"

 

I don't know what's wrong with this simple lines of code.

 

I am using TestComplete 12 and have MS Excel 2016 64 bit installed. Is it causing the problem?

 

Please help!

 

 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    It means that, for some reason, when you execute your code, the xls file is not found in the directory you're looking in.  Double check to make sure that, on the machine on which you're executing the code there is a D drive with a test1.xls in the root.

     

    Also... make sure that non-admin users have access to that root.  You might need to run TestComplete as an administrator to get access to D root.