I am new to writing excel macros. I am currently working with code that I have used from another project. Where I'm encountering a problem, is the screen in Attachmate where the entries are to be keyed will only allow 10 lines then the PF8 key need to be pressed in order for a new screen to appear. After the PF8 key is pressed, i need to loop but start copying from excel where it left off and not key the same 10 entries again. Help:-( The code i am attempting to use is below.
Do While Worksheets(WkshtName).Cells(Counter, 1).Value <> ""
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 1).Value
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 2).Value
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 3).Value
Screen.SendKeys "<tab>"
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 4).Value
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 5).Value
Screen.SendKeys Format(Worksheets(WkshtName).Cells(Counter, 6).Value, "0.00")
Screen.SendKeys "<tab>"
Counter = Counter + 1
LoopCounter = LoopCounter + 1
If LoopCounter = 10 Or Worksheets(WkshtName).Cells(Counter, 1).Value = "" Then
LoopCounter = 0
If (Screen.WaitForString(20, 6, 14)) = "ACTION" Then Exit Do
Screen.SendKeys ("<PF8>")
Screen.WaitHostQuiet (1000)
Do While (Screen.WaitForCursor(9, 12))
Loop
Else
AppActivate ("Microsoft Excel")
MsgBox "Error"
End If
Do While Worksheets(WkshtName).Cells(Counter, 1).Value <> ""
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 1).Value
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 2).Value
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 3).Value
Screen.SendKeys "<tab>"
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 4).Value
Screen.SendKeys Worksheets(WkshtName).Cells(Counter, 5).Value
Screen.SendKeys Format(Worksheets(WkshtName).Cells(Counter, 6).Value, "0.00")
Screen.SendKeys "<tab>"
Counter = Counter + 1
LoopCounter = LoopCounter + 1
If LoopCounter = 10 Or Worksheets(WkshtName).Cells(Counter, 1).Value = "" Then
LoopCounter = 0
If (Screen.WaitForString(20, 6, 14)) = "ACTION" Then Exit Do
Screen.SendKeys ("<PF8>")
Screen.WaitHostQuiet (1000)
Do While (Screen.WaitForCursor(9, 12))
Loop
Else
AppActivate ("Microsoft Excel")
MsgBox "Error"
End If