Working on Test Complete Keyword driven framework, which is now migrated from Win7 to Win10. All the environment URLs configuration and actions are in Excel sheet. Issue: During execution once the browser launched URL is not opening URL is not coming from the excel file Debug: While debugging found one error .

Error: Operation is not allowed when the object is closed.

Below is the code to read from Excel:

Function GetXLSRecordset(strFilePath, strSQL)
     On Error Resume next
     Set objConnection = CreateObject("ADODB.Connection")
     'Create Connection srting
     strConnectionstring = "Provider=Microsoft.ACE.OLEDB.16.0;" & _
               "Data Source=" & strFilePath & ";" & _
               "Extended Properties=Excel 16.0"

  Log.Enabled = True
  objConnection.Connectionstring = strConnectionstring
  'Open connection for assgined connection string
  'Create new recordset
  Set objRecordset = CreateObject("ADODB.Recordset")
  'Execute SQL Query
  objRecordset.Open strSQL, objConnection, adOpenStatic, adLockReadOnly
  record_Count = objRecordset.RecordCount
  Log.Message("Record Count: "&record_Count)

  Log.Enabled = True
  Set GetXLSRecordset = objRecordset
  Set objRecordset = Nothing
  Set objConnection = Nothing
End Function

System Configuration:
    TestComplete 14.x 32bit
    MS Excel 16.x 32bit
    MS Access DB driver 16.x 32 bit
    OS Win 10 

Every time I'll try to print objRecordset getting undefined, but it returns the count objRecordset.RecordCount

Tried all the possible solution found on community support but didn't work, please suggest me some workaround.

Everything is working properly on win7 machine.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.