Const
adLockOptimistic=3
Const
adCmdText= &H001
Set
objConnection = CreateObject("ADODB.Connection")
Set
objRecordSet = CreateObject("ADODB.Recordset")
Sqlquery="Select UserName,Password FROM [SheetName$] where
UserName='Vadivel.sekar'"
objConnection.Open
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data
Source="&"Excel Path" &
";" & _
"Extended
Properties=""Excel 8.0;HDR=Yes;"";"
objRecordset.Open
Sqlquery, objConnection, adOpenStatic, adLockOptimistic, adCmdText
Do Until
objRecordset.EOF
msgbox
objRecordset.Fields.Item("UserName")
msgbox
objRecordset.Fields.Item("Password")
objRecordset.MoveNext
Loop
Note: e.g. Excel Path=D:\Login Info\Sample.xls
Note: e.g. Excel Path=D:\Login Info\Sample.xls