I have written a macro which loads up a invoice and allows the user to enter the desired ifnormation and make a record of payment the entire macro works fine hower I have added a section to it enter set text in the payment screen which is internet explorer based, the section of code that attachmate doesn't like is;
.Document.all("Group ID").Value = "8164"
.Document.all("Invoice Number").Value = "8"
It compiles ok, everything before and after runs fine but i've tried putting objIE before these but still doesn't run these lines please find my code beleow thanks for you help in advance.
Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Dim MyScreen As Object
Dim MyArea As Object
Dim objIE As Object
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 the default wait timeout value
g_HostSettleTime = 0' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess1 As Object
Set Sess1 = System.ActiveSession
If (Sess1 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess1.Visible Then Sess1.Visible = TRUE
'--------------------------------------------------------------------------------
Dim IE As Object
AppActivate "Application name - Windows Internet explorer"
DoEvents
.Document.all("Group ID").Value = "8164"
.Document.all("Invoice Number").Value = "8"
While IE.busy
DoEvents
Wend
While IE.busy
DoEvents
Wend
'--------------------------------------------------------------------------------
' This section of code contains the recorded events
Sess1.Screen.Sendkeys("<Find>NBABA<Ctrl+M>")
Sess1.Screen.Sendkeys("NB50")
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("D<Ctrl+M>")
Sess1.Screen.WaitHostQuiet(10000)
Sess1.Screen.Sendkeys("<Find>")
Sess1.Screen.Sendkeys("<Right><Right><Right>1<Ctrl+M>")
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.MoveTo 23, 73, 01
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("AC")
Sess1.Screen.Sendkeys("<Tab>")
Sess1.Screen.Sendkeys("EPDQ - ")
'------------------------------------------------------------------------------- System Waits Until Enter Key Is Pressed
Dim waits as Object
Set waits = System.Waits
Dim w1 as Object
Set w1 = Sess1.Screen.Waitforkeys("<Keypad Enter>")
id1 = waits.Add(w1)
retval = waits.Wait(500000)
'------------------------------------------------------------------------------- Once Enter Key Pressed Again NB40 is Loaded
' Set the default wait timeout value
g_HostSettleTime = 100' milliseconds
Sess1.Screen.Waitforkeys("<Keypad Enter>")
Sess1.Screen.Sendkeys("<Find>NBABA<Ctrl+M>")
Sess1.Screen.Sendkeys("NB40<Ctrl+M>")
Sess1.Screen.Sendkeys("CREDIT CARD PAYMENT<Keypad 1><Keypad 2>/")
Sess1.Screen.putstring format(date,"yy"), 1,2
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("<Tab><Keypad 1>")
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.SendKeys ("<Tab>")
Sess1.Screen.putstring format(date,"ddmmyy"), 1,2
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("<Keypad 5>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("SK1 2FB<Tab>")
Sess1.Screen.Sendkeys("<Keypad 8><Keypad 1><Keypad 6><Keypad 4>")
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.MoveTo 15, 20, 01
'------------------------------------------------------------------------------- System Waits Until Enter Key Is Pressed
'Set waits = System.Waits
'Dim w2 as Object
'Set w2 = Sess1.Screen.Waitforkeys("<Keypad Enter>")
'id1 = waits.Add(w2)
'retval = waits.Wait(500000)
'------------------------------------------------------------------------------- Once Enter Key Pressed Again NB40 is Loaded
Sess1.Screen.Waitforkeys("<Keypad Enter>")
Sess1.Screen.Sendkeys("** COMPLETE **")
System.TimeoutValue = OldSystemTimeout
End Sub
.Document.all("Group ID").Value = "8164"
.Document.all("Invoice Number").Value = "8"
It compiles ok, everything before and after runs fine but i've tried putting objIE before these but still doesn't run these lines please find my code beleow thanks for you help in advance.
Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Dim MyScreen As Object
Dim MyArea As Object
Dim objIE As Object
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 the default wait timeout value
g_HostSettleTime = 0' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess1 As Object
Set Sess1 = System.ActiveSession
If (Sess1 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess1.Visible Then Sess1.Visible = TRUE
'--------------------------------------------------------------------------------
Dim IE As Object
AppActivate "Application name - Windows Internet explorer"
DoEvents
.Document.all("Group ID").Value = "8164"
.Document.all("Invoice Number").Value = "8"
While IE.busy
DoEvents
Wend
While IE.busy
DoEvents
Wend
'--------------------------------------------------------------------------------
' This section of code contains the recorded events
Sess1.Screen.Sendkeys("<Find>NBABA<Ctrl+M>")
Sess1.Screen.Sendkeys("NB50")
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("D<Ctrl+M>")
Sess1.Screen.WaitHostQuiet(10000)
Sess1.Screen.Sendkeys("<Find>")
Sess1.Screen.Sendkeys("<Right><Right><Right>1<Ctrl+M>")
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.MoveTo 23, 73, 01
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("AC")
Sess1.Screen.Sendkeys("<Tab>")
Sess1.Screen.Sendkeys("EPDQ - ")
'------------------------------------------------------------------------------- System Waits Until Enter Key Is Pressed
Dim waits as Object
Set waits = System.Waits
Dim w1 as Object
Set w1 = Sess1.Screen.Waitforkeys("<Keypad Enter>")
id1 = waits.Add(w1)
retval = waits.Wait(500000)
'------------------------------------------------------------------------------- Once Enter Key Pressed Again NB40 is Loaded
' Set the default wait timeout value
g_HostSettleTime = 100' milliseconds
Sess1.Screen.Waitforkeys("<Keypad Enter>")
Sess1.Screen.Sendkeys("<Find>NBABA<Ctrl+M>")
Sess1.Screen.Sendkeys("NB40<Ctrl+M>")
Sess1.Screen.Sendkeys("CREDIT CARD PAYMENT<Keypad 1><Keypad 2>/")
Sess1.Screen.putstring format(date,"yy"), 1,2
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("<Tab><Keypad 1>")
Sess1.Screen.Paste
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.SendKeys ("<Tab>")
Sess1.Screen.putstring format(date,"ddmmyy"), 1,2
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.Sendkeys("<Keypad 5>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("<Keypad .><Tab>")
Sess1.Screen.Sendkeys("SK1 2FB<Tab>")
Sess1.Screen.Sendkeys("<Keypad 8><Keypad 1><Keypad 6><Keypad 4>")
Sess1.Screen.WaitHostQuiet(g_HostSettleTime)
Sess1.Screen.MoveTo 15, 20, 01
'------------------------------------------------------------------------------- System Waits Until Enter Key Is Pressed
'Set waits = System.Waits
'Dim w2 as Object
'Set w2 = Sess1.Screen.Waitforkeys("<Keypad Enter>")
'id1 = waits.Add(w2)
'retval = waits.Wait(500000)
'------------------------------------------------------------------------------- Once Enter Key Pressed Again NB40 is Loaded
Sess1.Screen.Waitforkeys("<Keypad Enter>")
Sess1.Screen.Sendkeys("** COMPLETE **")
System.TimeoutValue = OldSystemTimeout
End Sub