I'm having trouble with the MoveTo where the cursor is not moving to the selection as anticipated. The entire macro is very long so I've included only the specific sub where the issue is occuring. All other aspects of the code are working as anticipated and desired with the exception of the cursor moving down to the coordinates specified before the enter key is pressed.
The specific code in question is:
SCR.MoveTo z,4 'where "z" is the 'For line count'
I also see the MoveTo not working as anticipated in other Attachmate macros from predecessors.
for instance I found a case select (see below) where MoveTo is also not working.
Select Case UCase(rptDate$)
Case "UNSETTLED"
SCR.MoveTo 10,29
Case "CURRENT DAY"
SCR.MoveTo 11,29
Case "PRIOR DAY"
SCR.MoveTo 12,29
Case "2 DAYS PRIOR"
SCR.MoveTo 13,29
End Select
Call PressEnter
Is anyone aware of any code changes or have alternatives available to the MoveTo that might get me moving in the right direction here?
Otherwise I will have to devise some sort of Case select that obtains the value of z and then presses the tab key the appropriate number of times which just seems cumbersome and illogical.
Here is my code for this sub:
(sorry had to remove indents so this wouldn't look ugly when pasting)
Sub i3964
Do
' sess.screen.GetString(x is row number, is cursor start position, is number of characters over)
' remember "...rw" is declared globally so previous row # in Excel is not overwritten
'*********START Capture********
Dim x as Integer
Dim strTempa as String
Dim strTempb as String
Dim strTempc as String
Dim strTempd as String
Dim strTempe as String
For x = 8 to 21 'total rows to capture
If strTempa = " " Then 'there is no description thus we have a blank line
Else
strTempa = sess.screen.GetString(x, 04, 21)
strTempb = sess.screen.GetString(x, 26, 06)
strTempc = sess.screen.GetString(x, 34, 06)
strTempd = sess.screen.GetString(x, 41, 12)
strTempe = sess.screen.GetString(x, 57, 22)
'write it to a specified row in the spreadsheet
With i3964sumSht
.Cells(tusumrw, "A").Value = strTempa
.Cells(tusumrw, "B").Value = strTempb
.Cells(tusumrw, "C").Value = strTempc
.Cells(tusumrw, "D").Value = strTempd
.Cells(tusumrw, "E").Value = strTempe
End With
tusumrw = tusumrw + 1
End If
next x
'*********END Capture*********
'Now check for exit point
If SCR.Search("< TOTAL TRANS >") = "< TOTAL TRANS >" Then Exit Do
Call PressF8 ' Advance the page if total trans was not found
Loop
'Now gather the summary page(s)
Call PressClear
Call PressClear
SCR.SendKeys("IXTU4417<Enter>") 'Temporary for Testing
'SCR.SendKeys("IXTU3964<Enter>") 'Actual for Production
SCR.SendKeys("<Tab><Enter>")
SCR.SendKeys("<Tab>") 'arrives at first green line
Do
Dim strdtlPlan as String
Dim strdtlRun as String
Dim strdtlTran as String
Dim strdtlInPt as String
Dim strdtlLnIt as String
Dim strdtlCnt as String
Dim strdtlAmt as String
Dim LnChk As String
Dim z as Integer
For z = 8 to 21
LnChk = sess.screen.GetString(z, 04, 21)
If LnChk = " " Then Exit Do 'we reached the last entry and can exit
SCR.MoveTo z,4 'Move the cursor to the 'z' line so we can action that line with the enter key
SCR.SendKeys("<Enter>") 'open line detail
Call PressF6 'scroll to the right
Do
'*********START Capture********
For x = 8 to 21
strdtlPlan = sess.screen.GetString(5, 59, 22)
strdtlRun = sess.screen.GetString(5, 09, 06)
strdtlTran = sess.screen.GetString(5, 26, 06)
strdtlInPt = sess.screen.GetString(6, 45, 25)
strdtlLnIt = sess.screen.GetString(x, 03, 25)
strdtlCnt = sess.screen.GetString(x, 45, 06)
strdtlAmt = sess.screen.GetString(x, 56, 23)
With i3964dtlSht
.Cells(tudtlrw, "A").Value = "IXTU"
.Cells(tudtlrw, "B").Value = strdtlPlan
.Cells(tudtlrw, "C").Value = strdtlRun
.Cells(tudtlrw, "D").Value = strdtlTran
.Cells(tudtlrw, "E").Value = strdtlInPt
.Cells(tudtlrw, "F").Value = strdtlLnIt
.Cells(tudtlrw, "G").Value = strdtlCnt
.Cells(tudtlrw, "H").Value = strdtlAmt
End With
tudtlrw = tudtlrw + 1
Next x
If SCR.Search("ALL PLANS PRESENT") = "ALL PLANS PRESENT" Then Exit Do
Call PressF6 'scroll to the right
Loop
Call PressF2
Next z
Loop
End Sub
The specific code in question is:
SCR.MoveTo z,4 'where "z" is the 'For line count'
I also see the MoveTo not working as anticipated in other Attachmate macros from predecessors.
for instance I found a case select (see below) where MoveTo is also not working.
Select Case UCase(rptDate$)
Case "UNSETTLED"
SCR.MoveTo 10,29
Case "CURRENT DAY"
SCR.MoveTo 11,29
Case "PRIOR DAY"
SCR.MoveTo 12,29
Case "2 DAYS PRIOR"
SCR.MoveTo 13,29
End Select
Call PressEnter
Is anyone aware of any code changes or have alternatives available to the MoveTo that might get me moving in the right direction here?
Otherwise I will have to devise some sort of Case select that obtains the value of z and then presses the tab key the appropriate number of times which just seems cumbersome and illogical.
Here is my code for this sub:
(sorry had to remove indents so this wouldn't look ugly when pasting)
Sub i3964
Do
' sess.screen.GetString(x is row number, is cursor start position, is number of characters over)
' remember "...rw" is declared globally so previous row # in Excel is not overwritten
'*********START Capture********
Dim x as Integer
Dim strTempa as String
Dim strTempb as String
Dim strTempc as String
Dim strTempd as String
Dim strTempe as String
For x = 8 to 21 'total rows to capture
If strTempa = " " Then 'there is no description thus we have a blank line
Else
strTempa = sess.screen.GetString(x, 04, 21)
strTempb = sess.screen.GetString(x, 26, 06)
strTempc = sess.screen.GetString(x, 34, 06)
strTempd = sess.screen.GetString(x, 41, 12)
strTempe = sess.screen.GetString(x, 57, 22)
'write it to a specified row in the spreadsheet
With i3964sumSht
.Cells(tusumrw, "A").Value = strTempa
.Cells(tusumrw, "B").Value = strTempb
.Cells(tusumrw, "C").Value = strTempc
.Cells(tusumrw, "D").Value = strTempd
.Cells(tusumrw, "E").Value = strTempe
End With
tusumrw = tusumrw + 1
End If
next x
'*********END Capture*********
'Now check for exit point
If SCR.Search("< TOTAL TRANS >") = "< TOTAL TRANS >" Then Exit Do
Call PressF8 ' Advance the page if total trans was not found
Loop
'Now gather the summary page(s)
Call PressClear
Call PressClear
SCR.SendKeys("IXTU4417<Enter>") 'Temporary for Testing
'SCR.SendKeys("IXTU3964<Enter>") 'Actual for Production
SCR.SendKeys("<Tab><Enter>")
SCR.SendKeys("<Tab>") 'arrives at first green line
Do
Dim strdtlPlan as String
Dim strdtlRun as String
Dim strdtlTran as String
Dim strdtlInPt as String
Dim strdtlLnIt as String
Dim strdtlCnt as String
Dim strdtlAmt as String
Dim LnChk As String
Dim z as Integer
For z = 8 to 21
LnChk = sess.screen.GetString(z, 04, 21)
If LnChk = " " Then Exit Do 'we reached the last entry and can exit
SCR.MoveTo z,4 'Move the cursor to the 'z' line so we can action that line with the enter key
SCR.SendKeys("<Enter>") 'open line detail
Call PressF6 'scroll to the right
Do
'*********START Capture********
For x = 8 to 21
strdtlPlan = sess.screen.GetString(5, 59, 22)
strdtlRun = sess.screen.GetString(5, 09, 06)
strdtlTran = sess.screen.GetString(5, 26, 06)
strdtlInPt = sess.screen.GetString(6, 45, 25)
strdtlLnIt = sess.screen.GetString(x, 03, 25)
strdtlCnt = sess.screen.GetString(x, 45, 06)
strdtlAmt = sess.screen.GetString(x, 56, 23)
With i3964dtlSht
.Cells(tudtlrw, "A").Value = "IXTU"
.Cells(tudtlrw, "B").Value = strdtlPlan
.Cells(tudtlrw, "C").Value = strdtlRun
.Cells(tudtlrw, "D").Value = strdtlTran
.Cells(tudtlrw, "E").Value = strdtlInPt
.Cells(tudtlrw, "F").Value = strdtlLnIt
.Cells(tudtlrw, "G").Value = strdtlCnt
.Cells(tudtlrw, "H").Value = strdtlAmt
End With
tudtlrw = tudtlrw + 1
Next x
If SCR.Search("ALL PLANS PRESENT") = "ALL PLANS PRESENT" Then Exit Do
Call PressF6 'scroll to the right
Loop
Call PressF2
Next z
Loop
End Sub