Remou, thanks, here goes; it all works except for the bits where I'm trying to run an If Then statement regarding whether there's any text in field 17, 17, 1.
_____________________
Option Compare Database
________________________
Sub CertifyAndCloseReplacementJobs()
Dim oDB As Database 'ACCESS CODE
Dim oRS As DAO.Recordset 'ACCESS CODE
Dim vSomeVal
Dim System As Object, Sessions As Object, Sess As Object, CSS As Object
Dim msg_line As String ' ? not sure here!
Set System = CreateObject("EXTRA.System") ' Gets the system object
If (System Is Nothing) Then
MsgBox "Could not create the EXTRA System object. Stopping macro playback."
Stop
End If
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then
MsgBox "Could not create the Sessions collection object. Stopping macro playback."
Stop
End If
Set CSS = GetObject("C:\Documents and Settings\zeicri\Desktop\SMNXS06.edp")
Set Sess = System.ActiveSession
Set oDB = OpenDatabase("S:\CommonARUK01\FinAccouUK01\Fixed Asset\SDH\SDH CERTIFICATIONS\CERTIFICATION DATABASE") 'ACCESS CODE
Set oRS = oDB.OpenRecordset("BP INFORMATION") 'ACCESS CODE
If (Sess Is Nothing) Then
MsgBox "Could not create the Session object. Stopping macro playback."
Stop
End If
If Not Sess.Visible Then Sess.Visible = True
msg_line = MyScreen.GetString(17, 17, 1) ' ? not sure here either!
Sess.Screen.SendKeys ("<Home>MLAD<Enter>")
Call Wait(Sess)
If Not oRS.BOF Then
oRS.MoveFirst
Do While Not oRS.EOF
'MLAD HERE:
Sess.Screen.SendKeys ("<Tab>")
Sess.Screen.SendKeys (Trim(oRS.Fields("New Job").Value) & "<Enter>")
Call Wait(Sess)
Sess.Screen.SendKeys ("<NewLine><NewLine><NewLine><NewLine><NewLine><NewLine><NewLine>Y<Enter>")
Call Wait(Sess)
Sess.Screen.SendKeys ("<Pf5>")
Call Wait(Sess)
Sess.Screen.SendKeys ("1")
Call Wait(Sess)
Sess.Screen.SendKeys ("<Pf5>")
Call Wait(Sess)
'MFAD HERE: - not sure here
If (msg_line) <> " " Then
Sess.Screen.SendKeys ("<NewLine><NewLine><NewLine>")
Sess.Screen.SendKeys Trim(oRS.Fields("New Job Title").Value) 'TITLE
Sess.Screen.SendKeys ("<Enter>")
Call Wait(Sess)
End If
Sess.Screen.SendKeys ("<Pf15>")
Call Wait(Sess)
'MCLO HERE:
Loop
End If
End Sub
--------------
Private Sub Wait(Sess As Object)
Do While Sess.Screen.OIA.XStatus <> 0
DoEvents
Loop
End Sub
"No-one got everything done by Friday except Robinson Crusoe...