I am trying to fetch values from Excel using below code in .VBS:
strScenarioSheet = "D:\User.xlsx"
strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
strScenarioSheet & ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1"""
strSQL_TC = "Select * from [TestCases$] where [Flag]='Y'"
Set objTot = getRecords(strConnection,strSQL_TC)
MsgBox objTot.RecordCount
Function getRecords(strConnection,strSQL_TC)
Set objConn = CreateObject("ADODB.Connection")
objConn.Open strConnection
Set objRec = CreateObject("ADODB.Recordset")
objRec.CursorLocation = 3
objRec.Open strSQL_TC,strConnection
objRec.ActiveConnection = Nothing
Set getRecords=objRec.Clone
objConn.Close
Set objConn = Nothing
objRec.Close
Set objRec = Nothing
End Function
I get this below error:
Why do I get this provider not installed even though I have it in (C:\Windows\SysWOW64):
I tried using this thread by clicking cscript and then running vbs. But still I get the same error.