Forum Discussion

royd's avatar
royd
Regular Contributor
7 years ago
Solved

Checked everything, but still getting "An attempt to work with a closed driver" (DDT - ExcelDriver)!

I have installed Microsoft Access Database Engine 2010 already. Using TestComplete 12.3 and Excel 2013. I am still getting "An attempt to work with a closed driver" error! Here is my script (JavaScript) -

try
    {
      DDT.ExcelDriver("c:\\femalePatients.xlsx", "Female_E");
  
      
            while (!DDT.CurrentDriver.EOF())
	    {
	      if (DDT.CurrentDriver.Value("Name") == "Lizzie Hari")
	        {
	          New_Patients.createPatients();
	        }
	      DDT.CurrentDriver.Next();
	    } 
    } 
    
    
    
    catch(exception)
    {
      Log.Error(exception.message);
    }
  DDT.CloseDriver(DDT.CurrentDriver.Name);

 

I even restarted the computer to make sure DDT drivers not running, still no go!

 

Help is much appreciated.

 

Dave

  • Change your code to the following:

    DDT.ExcelDriver("c:\\femalePatients.xlsx", "Female_E", true)

    and see if that works. 

6 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Change your code to the following:

    DDT.ExcelDriver("c:\\femalePatients.xlsx", "Female_E", true)

    and see if that works. 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Most likely it is because the driver could not open your file....   And, considering that your file is in the root of C, that's probably your problem...  new security in windows environments does not allow read/write access to root of C easily...  Try moving your file into a different directory and see if it works better.  

     

    The error is a bit misleading... basically, the DDT.CurrentDriver is not open because there was some problem in actually opening the driver.  If it couldn't get to the file, that's the problem. 

    • royd's avatar
      royd
      Regular Contributor

      Hi Robert

       

      Thanks for your reply. I tried after placing the Excel file in C:\Users\user\Patient_Data\ . I am getting the same error! :(