Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If Then statement inside For loop
#1
Not Solved
Hi,
Below code is giving me some errors and am not able to figure it out why the errors are showing up??

Code:
Dim i
Set expectedResults = DataTable.GetSheet(dtGlobalSheet)
For i = 1 To 3
Browser("x").Page("y").WebEdit("a").Set DataTable("a", dtGlobalSheet)
Browser("x").Page("y").WebEdit("b").Set DataTable("b", dtGlobalSheet)
Set a = Browser("x").Page("y").WebEdit("a").GetROProperty("Value")
If a =  "[Select a] " Then
    Browser("x").Page("y").WebEdit("c").Set " "
    Else If  a =  "Value " Then
    Browser("x").Page("y").WebEdit("c").Set " "
    Else  If a =  "Value1 " Then
    Browser("x").Page("y").WebElement("d").Click
End If
Browser("x").Page("y").WebElement("e").Click
Browser("x").Page("y").WebElement("f").Check CheckPoint("f")
ExpectedResults.SetNextRow
Next

The above when saved gives me following errors
--Unexpected Next
--Expected End If

So changed the next and end if accordingly - but of no use.
Can anyone help me please???
Reply
#2
Not Solved
Hi Mala,

It is ElseIf. Remove the space between else and if from your code.
Reply
#3
Not Solved
Thanks Manish
Reply
#4
Not Solved
Did that work?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Read Content inside PDF kotaramamohana 0 1,092 09-02-2020, 05:49 PM
Last Post: kotaramamohana
  Fetching total number of records inside a webtable vidya2k2 2 3,651 06-15-2015, 02:55 PM
Last Post: venkatesh9032
  Infinit loop Suma Parimal 1 2,640 05-29-2014, 01:22 PM
Last Post: basanth27
  Exit Do loop shipu 1 4,725 12-20-2013, 06:33 AM
Last Post: basanth27
Smile Infinite FOR loop issue Sivapratha 3 4,184 04-01-2013, 09:44 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)