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!

*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.

Jobs

Macro Compile Error

Macro Compile Error

(OP)
Hey everyone. I'm hoping to get some help with a macro I'm trying to write. I'm getting a consistent compile error and I'm not sure why (I haven't written in this language for very long, so bear with me). It's consistently telling me that the compile error is occuring because of the "end sub" at the bottom of the macro. Let me know what I need to do to make this work the right way and I appreciate any help you can offer!


Sub Main
SessID$ = GetFirstSession()
If SessID$ = "" Then
MsgBox "No session available. Macro playback cancelled."
Exit Sub
End If
rc% = ConnectSession(SessID)
If rc% <> 1 and rc% <> 5 Then
MsgBox "Failed to connect to session " + SessID$ +" Macro playback cancelled."
rc% = ResetSystem()
Exit Sub
End If

close
Open "C:\Documents and Settings\user\Desktop\UPC.txt" for input as #1
Open "C:\Documents and Settings\user\Desktop\Group.txt" for append as #2
Close #2
Kill "C:\Documents and Settings\user\Desktop\Group.txt"
Open "C:\Documents and Settings\user\Desktop\Group.txt" for append as #2

CheckScreen1:
rc% = GetString (2,2,Test$,5)
If Test$ <> "CPNU2" then
msgbox "Must be Run from CPNU2"
rc% = ResetSystem()
Exit Sub
End If

UPCRecord:
rc% = GetString(16,05, UPC1$, 13)
rc% = GetString(16,19, UPC2$, 13)
rc% = GetString(16,33, UPC3$, 13)
rc% = GetString(16,47, UPC4$, 13)
rc% = GetString(16,61, UPC5$, 13)
rc% = GetString(17,05, UPC6$, 13)
rc% = GetString(17,19, UPC7$, 13)
rc% = GetString(17,33, UPC8$, 13)
rc% = GetString(17,47, UPC9$, 13)
rc% = GetString(17,61, UPC10$, 13)
rc% = GetString(18,05, UPC11$, 13)
rc% = GetString(18,19, UPC12$, 13)
rc% = GetString(18,33, UPC13$, 13)
rc% = GetString(18,47, UPC14$, 13)
rc% = GetString(18,61, UPC15$, 13)
rc% = GetString(19,05, UPC16$, 13)
rc% = GetString(19,19, UPC17$, 13)
rc% = GetString(19,33, UPC18$, 13)
rc% = GetString(19,47, UPC19$, 13)
rc% = GetString(19,61, UPC20$, 13)
rc% = GetString(20,05, UPC21$, 13)
rc% = GetString(20,19, UPC22$, 13)
rc% = GetString(20,33, UPC23$, 13)
rc% = GetString(20,47, UPC24$, 13)
rc% = GetString(20,61, UPC25$, 13)


UPCWrite:
Write #2, UPC1$
Write #2, UPC2$
Write #2, UPC3$
Write #2, UPC4$
Write #2, UPC5$
Write #2, UPC6$
Write #2, UPC7$
Write #2, UPC8$
Write #2, UPC9$
Write #2, UPC10$
Write #2, UPC11$
Write #2, UPC12$
Write #2, UPC13$
Write #2, UPC14$
Write #2, UPC15$
Write #2, UPC16$
Write #2, UPC17$
Write #2, UPC18$
Write #2, UPC19$
Write #2, UPC20$
Write #2, UPC21$
Write #2, UPC22$
Write #2, UPC23$
Write #2, UPC24$
Write #2, UPC25$


Checkend:
Sendhostkeys("@8")
rc% = WaitForNoX
rc% = WaitHostQuiet(100)

rc% = GetString (24,11, Test2$, 30)
If Test2$ = "THIS IS THE LAST PAGE OF UPC'S" then
Goto Ending
Else
Goto UPCRecord

Ending:
Close

msgbox "Finished"
rc% = ResetSystem()

End Sub



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!

Resources

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