Jump to content
Sign in to follow this  

Show Data from Excel file - not showing

Recommended Posts


This is a converted scritp from VBScript that runs fine.

But when running it in AutoIT last Beta & Official release it does not show the values ?

I does only loop through the records.

Anyone any idea's or is this a bug.

Const $adOpenStatic = 3
Const $adLockOptimistic = 3
Const $adCmdText = 0x0001 ;  =&H0001

 $objConnection = ObjCreate("ADODB.Connection")
 $objRecordSet = ObjCreate("ADODB.Recordset")

$objConnection.Open ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=C:\Book1.xls;" & _
        "Extended Properties=""Excel 8.0;HDR=Yes;"";")

$objRecordSet.Open ("Select * FROM [Sheet1$]", _
        $objConnection, $adOpenStatic, $adLockOptimistic, $adCmdText)

    msgbox (0,"Test",$objRecordSet.Fields.Item("Plant")&" "& $objRecordSet.Fields.Item("CustomerCode"))
    ; ConsoleWrite (0,"Test",$objRecordSet.Fields.Item("Plant")&" "& $objRecordSet.Fields.Item("CustomerCode"))
Until $objRecordSet.EOF()

This is the VBScript that does run OK.

Const adOpenStatic = 3

Const adLockOptimistic = 3

Const adCmdText = &H0001

Set objConnection = CreateObject("ADODB.Connection")

Set objRecordSet = CreateObject("ADODB.Recordset")

objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _

"Data Source=C:\Book1.xls;" & _

"Extended Properties=""Excel 8.0;HDR=Yes;"";"

objRecordset.Open "Select * FROM [sheet1$]", _

objConnection, adOpenStatic, adLockOptimistic, adCmdText

Do Until objRecordset.EOF

Wscript.Echo objRecordset.Fields.Item("Plant"), _




Before testing make an Excel file with 2 column called "Plant" & "CustomerCode"

Fill it up with some values, and run !!



Share this post

Link to post
Share on other sites


SvenP wrote a bug report for me about this;

msgbox (0,"Test",$objRecordSet.Fields.Item("Plant").value&" "& $objRecordSet.Fields.Item("CustomerCode").value)
Sometimes the automatic finding of the object value in vbs is obscured; AutoIt does not do it.; add ".value" and it works!

Best, randall

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.