You need to use
Set objFso=CreateObject("Excel.Application")
On Sun, Feb 27, 2011 at 2:21 PM, Ganesh muralidharan <[email protected]>wrote:
> Instead of using OpenTextFile("E:\Userlist.xls",1) why can't you use
> Datatable.importsheet?
>
> Have u tried checking the value of array myField? The subscript error must
> be happening because the myField(1) element never got created and
> the entire split data us stored in myField(0)
>
>
> On Sun, Feb 27, 2011 at 2:40 AM, Sujith C S <[email protected]> wrote:
>
>> HI friends,
>>
>>
>> My Aim was to read an excel file and use the values in each colums for
>> data driven testing.
>>
>>
>> I have an excel file,in which the 1st clm is username (with column
>> heading),and 2nd column is password(1st row is heading).File attached
>>
>> Below script which i used to run flight app, results in error
>>
>>
>>
>> Subscript out of range in line"Dialog("text:=Login").WinEdit("attached
>> text:=Agent Name:").Set myField(1)". "
>>
>> Please help me to find out the error in my code,
>>
>> Thanks in advance
>>
>>
>>
>> Dim objFso, myFile, myLine, myField
>> Set objFso=CreateObject("Scripting.FileSystemObject")
>> Set myFile=objFso.OpenTextFile("E:\Userlist.xls",1)
>>
>> Do Until myFile.AtEndOfStream
>> myLine=myFile.ReadLine
>> myField=Split(myLine,",")
>> SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest
>> Professional\samples\flight\app\flight4a.exe"
>> Dialog("text:=Login").Activate
>> Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set myField(0)
>> Dialog("text:=Login").WinEdit("attached text:=Password:").Set myField(1)
>> wait 2
>> Dialog("text:=Login").WinButton("text:=OK").Click
>> Window("text:=Flight Reservation").Close
>> Loop
>> myFile.Close
>> Set objFso=Nothing
>>
>>
>>
>> --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>
>
>
>
> --
> Regards,
>
>
> Ganesh Muralidharan
> 'God Never Forgets'
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en