Class room excel script

Dim xl,wb,ws

Set xl=CreateObject("Excel.Application")
Set wb=xl.Workbooks.Open("f:\data.xls")
Set ws=wb.Worksheets("Sheet1")
For i=2 to 5
   e=ws.cells(i,6)
   td=ws.cells(i,9)
   a=split(td,",")
   Systemutil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
  Dialog("Login").WinEdit("Agent Name:").Set a(0)
  Dialog("Login").WinEdit("Password:").Set a(1)
  Dialog("Login").WinButton("OK").Click
If window("Flight Reservation").Exist Then
  f=1
  window("Flight Reservation").Close
 else
  f=0
  Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
  Dialog("Login").Close
End If
If (f=1 and e="Login") or (f=0 and e="Error") Then
   ws.cells(i,7)="Expected and actual are same"
   ws.cells(i,8)="Passed"
   ws.cells(i,8).interior.colorindex=4
else
  ws.cells(i,7)="Expected and actual are not same"
  ws.cells(i,8)="Failed"
  ws.cells(i,8).interior.colorindex=3
End If
Next
wb.Save
wb.Close
Set xl=nothing

Comments