TCUser_g
3 years agoNew Contributor
Test Complete Unable to load URL from Excel
Working on Test Complete Keyword driven framework, which is now migrated from Win7 to Win10. All the environment URLs configuration are in Excel sheet.
Issue: During execution once the browser launched URL is not opening
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
Log.Message(strFilePath&"::"&strSQL)
objConnection.Connectionstring = strConnectionstring
'Open connection for assgined connection string
objConnection.Open
'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
objRecordset.Close
Set objRecordset = Nothing
objConnection.Close
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.