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!

Macro Compile Error

Status
Not open for further replies.

Eaglboy1

Technical User
Feb 16, 2017
1
US
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



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top