Ask a Question

Unable to load URL from Excel in Test Complete

Raymondtailor
Occasional Contributor

Unable to load URL from Excel in Test Complete

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 . MyCCPay Portal

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.

2 REPLIES 2
Kitt
Regular Contributor

It's been a while sine I've used VB script - could you please post the full error from your TestComplete log? Also do you have MS Office 32 or 64 installed on the machine?

 

Here's a Microsoft forum post about it [here]. <-- check that your MS Office Suite is 32 bit

 

[MS reference] for adding the appropriate Extended Properties of the OLEDB connection string based on the Excel file type

[[ kITt: keep IT testing ]]
rraghvani
Valued Contributor

I thought I recognised the code. It's been discussed in this post (which is the same!) https://community.smartbear.com/t5/TestComplete-Questions/Test-Complete-Unable-to-load-URL-from-Exce...

 

cancel
Showing results for 
Search instead for 
Did you mean: