Dim objSystem As Object
Dim objSessions As Object
Dim sf602431 As Object
Dim timestamp2 As Object
Dim cc2 As Object
Dim machgrp2 As Object
Dim ngrp2 As Object
Dim wseq2 As Object
Dim part2 As Object
Dim trav2 As Object
Dim qty2 As Object
Dim location2 As Object
Dim oper2 As Object
Dim holdc2 As Object
Dim lmov2 As Object
Dim note2 As Object
Dim message2 As Object
Dim x2 As Integer
Dim XX2 As Integer
Dim y2 As Integer
Dim x4 As Integer
Dim y4 As Integer
Dim lastx4 As Integer
Dim start2 As Date
Dim finish2 As Date
Public Sub Get_sf602431()
'clear old data
Sheets("Output_trav").Select
Range("A2:M5000").Select
Selection.ClearContents
'begin reading inputs
Sheets("Input").Select
Range("A2").Select
start2 = Now
x2 = ActiveCell.Row
y2 = ActiveCell.Column
XX2 = 2
Do While IsEmpty(ActiveCell) = False
get_sf602431_details
x2 = x2 + 1
Application.GoTo reference:=ActiveSheet.Cells(x2, y2)
Loop
Sheets("Input").Select
Range("A1").Select
finish2 = Now
msgtext = "The macro started at : " & start2 & " and ended at : " & finish2
MsgBox msgtext
End Sub
Private Sub get_sf602431_details()
Set sys2 = CreateObject("extra.system")
Set sess2 = sys2.activesession
Set sf602431 = sess2.screen
Set cc2 = sf602431.area(2, 6, 2, 9)
cc2.Value = " "
cc2.Value = ActiveCell.Value
NXTPAGE:
sf602431.moveto 2, 80
sf602431.SendKeys ("<ENTER>")
REENTER:
sf602431.MoveRelative 1, 1
Do
DoEvents
datarefreshed = True
Loop Until sf602431.waitforcursor(2, 6)
If datarefreshed Then
Set message2 = sf602431.area(22, 2, 22, 27)
message2.Value = sf602431.area(22, 2, 22, 27).Value
If message2.Value = "COST CENTER IS NOT ON FILE" Then
READLINES2
GoTo FINI
End If
If message2.Value = "INQUIRY COMPLETE " Then
READLINES2
GoTo FINI
End If
If message2.Value = "PRESS ENTER FOR NEXT PAGE " Then
READLINES2
GoTo NXTPAGE
End If
' If message2.Value = "LAST PAGE DISPLAYED " Then
' READLINES2
' GoTo FINI
' End If
End If
FINI:
Set sys2 = Nothing
Set sess2 = Nothing
Set sf602431 = Nothing
Set trav2 = Nothing
Set note2 = Nothing
Set message2 = Nothing
End Sub
Private Sub READLINES2()
Set timestamp2 = sf602431.area(1, 61, 1, 77)
Set cc2 = sf602431.area(2, 6, 2, 9)
Set message2 = sf602431.area(22, 2, 22, 27)
cc2.Value = sf602431.area(2, 6, 2, 9).Value
timestamp2.Value = sf602431.area(1, 61, 1, 77).Value
message2.Value = sf602431.area(22, 2, 22, 27).Value
For w = 8 To 21
Set machgrp2 = sf602431.area(w, 7, w, 11)
Set ngrp2 = sf602431.area(w, 13, w, 16)
Set wseq2 = sf602431.area(w, 18, w, 22)
Set part2 = sf602431.area(w, 23, w, 39)
Set trav2 = sf602431.area(w, 40, w, 46)
Set qty2 = sf602431.area(w, 53, w, 57)
Set location2 = sf602431.area(w, 59, w, 64)
Set oper2 = sf602431.area(w, 66, w, 68)
Set holdc2 = sf602431.area(w, 71, w, 74)
Set lmov2 = sf602431.area(w, 77, w, 80)
machgrp2.Value = sf602431.area(w, 7, w, 11).Value
ngrp2.Value = sf602431.area(w, 13, w, 16).Value
wseq2.Value = sf602431.area(w, 18, w, 22).Value
part2.Value = sf602431.area(w, 23, w, 39).Value
trav2.Value = sf602431.area(w, 40, w, 46).Value
qty2.Value = sf602431.area(w, 53, w, 57).Value
location2.Value = sf602431.area(w, 59, w, 64).Value
oper2.Value = sf602431.area(w, 66, w, 68).Value
holdc2.Value = sf602431.area(w, 71, w, 74).Value
lmov2 = sf602431.area(w, 77, w, 80).Value
'if trav is blank then skip lines
If trav2.Value = " " Then
w = 21
End If
'if pn and oper are not blank
If part2.Value <> " " And trav2.Value <> " " Then
Sheets("Output_trav").Cells(XX2, 1).Value = "'" & Trim(cc2.Value)
Sheets("Output_trav").Cells(XX2, 2).Value = "'" & Trim(machgrp2.Value)
Sheets("Output_trav").Cells(XX2, 3).Value = Trim(ngrp2.Value)
Sheets("Output_trav").Cells(XX2, 4).Value = "'" & Trim(wseq2.Value)
Sheets("Output_trav").Cells(XX2, 5).Value = Trim(part2.Value)
Sheets("output_trav").Cells(XX2, 6).Value = "'" & Trim(trav2.Value)
Sheets("Output_trav").Cells(XX2, 7).Value = Trim(qty2.Value)
Sheets("Output_trav").Cells(XX2, 8).Value = "'" & Trim(location2.Value)
Sheets("Output_trav").Cells(XX2, 9).Value = "'" & Trim(oper2.Value)
Sheets("Output_trav").Cells(XX2, 10).Value = Trim(holdc2.Value)
Sheets("Output_trav").Cells(XX2, 11).Value = "'" & Trim(lmov2.Value)
Sheets("Output_trav").Cells(XX2, 12).Value = Trim(timestamp2.Value)
Sheets("Output_trav").Cells(XX2, 13).Value = Trim(message2.Value)
XX2 = XX2 + 1
End If
Next w
Set machgrp2 = Nothing
Set ngrp2 = Nothing
Set wseq2 = Nothing
Set part2 = Nothing
Set trav2 = Nothing
Set qty2 = Nothing
Set location2 = Nothing
Set oper2 = Nothing
Set holdc2 = Nothing
Set lmov2 = Nothing
Set timestamp2 = Nothing
Set message2 = Nothing
Set note2 = Nothing
End Sub