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!

When max date is found then enter into that record

Status
Not open for further replies.

Biznez

Technical User
Apr 9, 2015
106
CA
Hi,
Trying to write a vba code in excel where when in Mainframe the max date from location (8,54,8) to bottom of page is found then go into that record by entering "E" at location (x,02). Hope i made sense.
Thanks
 
im just confused about this statement you posted earlier

If Trim(DateString) = "" Then Exit For


This would just exit the loop
 
Here is YOUR date string
Code:
Sess0.Screen.GetString(i, 54, 8)

Code:
If Trim([highlight #FCE94F]DateString[/highlight]) = "" Then Exit For
So you SUBSTITUTE that code for [highlight #FCE94F]DateString[/highlight]

Code:
If Trim(Sess0.Screen.GetString(i, 54, 8)) = "" Then Exit For
 
Hi Skip, thanks for your help but now im getting error 'Type Mismatch"

Code:
Dim dMaxDTE As Date, rw As Integer

    Do

        For i = 8 To 17
                If Trim(Sess0.Screen.GetString(i, 54, 8)) = "" Then Exit For
                If dMaxDTE < DateValue(Trim(Sess0.Screen.GetString(i, 54, 8))) Then
                dMaxDTE = DateValue(Sess0.Screen.GetString(i, 54, 8))
                rw = i
            End If
        Next i
        'entering "E" at location (x,02).
        [COLOR=#EF2929]Sess0.Screen.PutString(rw, 2) = "E"[/color]
        'Sess0.Screen.SendKeys ("<Enter>")
        If Sess0.Screen.GetString(23, 2, 4) = ("4941") Then Exit Do

        'Sends the next page command
        Sess0.Screen.SendKeys ("<Pf8>")
        Do Until (Sess0.Screen.WaitForCursor(r, c)) 'r,c is screen cursor rest coordinates
            DoEvents
        Loop
    Loop
 
I have not coded Attachmate objects for over 3 years. So check the systax for PutString in Extra VB HELP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top