Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bug Problem. "Illegal Statement" Help!!!!!

Status
Not open for further replies.

Crash171

Programmer
Sep 5, 2014
30
US
Please help! I'm writing my first If/Then statement within a loop and having a little trouble. When I compile the code the dreaded red bug warning pops up on the last line and I get two errors. They are:

* "Illegal Statement" If I click where "End Sub" is located
* "Unexpected end of file" If I click on the empty line below "End Sub"

Here is the code that I wrote:

Code:
Do Until Sess0.Screen.GetString(20, 12, 5) = "     "
    DoEvents
        Sess0.Screen.MoveTo 11,06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 12,06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 13,06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 14,06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 15, 06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 16,06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 17,06.
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 18,06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 19,06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.MoveTo 20,06
        Sess0.Screen.Sendkeys("D")
        Sess0.Screen.Sendkeys("<Enter>")
        Sess0.Screen.WaitHostQuiet(g_HostSettleTime) 
        
	If (Sess0.Screen.GetString(1, 35, 6) = "DELETE") Then
    	    Do Until Sess0.Screen.GetString(1, 35, 6) = "      "
        Sess0.Screen.Sendkeys("<Enter>")
    	Sess0.Screen.Sendkeys(" ")
        Sess0.Screen.WaitHostQuiet(g_HostSettleTime) 
        Sess0.Screen.Sendkeys("<Enter>")

Loop

	System.TimeoutValue = OldSystemTimeout
End Sub
 
Hi,

1) you're missing an End If on the If statement with = "DELETE"

2) you're missing a Loop on the following Do Until statement.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top