×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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 

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

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.

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

This question has been double posted. Please answer in the other thread.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close