Trying to close an application when it had a pop up box to ask you "yes" or "no". I have tried .close, Application.Quit......Not sure how to get this done? Any help would be appreciated.
Public Id, Ps As String, Sys, MyScreen, Sess0 As Object, Sess1 As Object
Public Const Max As Integer = 25000
Public txtModel, txtVIN As String
Public System As Object
Public Sess3 As Object
Public Sessions As Object
Public g_HostSettleTime As Integer
Public OldSystemTimeout As Integer
Public Found1st As String
Public ChkSign As String
Public CHKCURSOR
Public Row As Integer
Public Col As Integer
Public Length As Integer
Public SignIn As String
Public CKBAL As String
Sub Autpen()
Dim Id As String
Dim Ps As String
' this is used only when setting up the master file
' run this only at the begining of the promotion
' Get the main system object
Set System = CreateObject("EXTRA.System")
If (System Is Nothing) Then
MsgBox "Could not create the EXTRA! System object. Aborting macro playback.", 48, "DateCapture"
Stop
End If
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then
MsgBox "Could not create the Session object. Stopping macro playback."
End
End If
'Set Sess3 = Sessions.Open("Session3.EDP")
Set Sess3 = GetObject("c:\program files\e!pc\sessions\Session1.EDP")
If (Sess3 Is Nothing) Then
MsgBox "Could not create the Session object. Stopping macro playback."
End
End If
System.TimeoutValue = 2000
Found1st = Sess3.Screen.WaitForString("WELCOME TO NISSAN", 2, 21)
If Found1st Then
End If
' Set the default wait timeout value
g_HostSettleTime = 2000 ' milliseconds
OldSystemTimeout = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Sets the Session to minimized and visible
If Not Sess3.Visible Then Sess3.Visible = True
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
'Checks and Sets the session to the opening screen
ChkSign = Sess3.Screen.GetString(2, 21, 17)
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
If ChkSign <> "WELCOME TO NISSAN" Then
'clear the screen and restart
Sess3.Screen.SendKeys ("<CLEAR>")
'Check to see if the system clock is busy
If BusyClock(Sess3.Screen) = 1 Then
Exit Sub
End If
Sess3.Screen.SendKeys ("<Pf12>")
'Check to see if the system clock is busy
If BusyClock(Sess3.Screen) = 1 Then
Exit Sub
End If
End If
'Checks the cursor to see if it is ready for entry
CHKCURSOR = Sess3.Screen.WaitForCursor(24, 7)
' Enters information to get to the sign on screen
Id = "xxxxxxxx"
Ps = "xxxxxxxxx"
If CHKCURSOR Then
Sess3.Screen.SendKeys ("pmac<Enter>")
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(1, 2)
If CHKCURSOR Then
Sess3.Screen.SendKeys ("<Enter>")
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(4, 14)
If CHKCURSOR Then
Sess3.Screen.SendKeys ("" & Id & "<NewLine>")
Sess3.Screen.SendKeys ("" & Ps & "<Enter>")
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
End If
CkSign = Sess3.Screen.GetString(7, 20, 19)
If CkSign <> "SIGN-ON IS COMPLETE" Then
' Stop
Else
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(1, 2)
If CHKCURSOR Then
Sess3.Screen.SendKeys ("LV00 <Enter>")
' Check to see if the system clock is busy
If BusyClock(Sess3.Screen) = 1 Then
Exit Sub
End If
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(20, 48)
If CHKCURSOR Then
Sess3.Screen.SendKeys ("01turtle<Enter>")
' Check to see if the system clock is busy
If BusyClock(Sess3.Screen) = 1 Then
Exit Sub
End If
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(21, 23)
End Sub
Function BusyClock(MyScreen As Object) As Integer
'Function to loop the Constant "Max" number of times until the system clock " & _
is no longer busy (0) or exceeds "Max" (1)
For counter = 1 To Max
counter = counter + 1
If MyScreen.OIA.XStatus = 0 Then
BusyClock = 0
Exit Function
End If
Next
MsgBox ("The System Timed Out.")
BusyClock = 1
End Function
Public Id, Ps As String, Sys, MyScreen, Sess0 As Object, Sess1 As Object
Public Const Max As Integer = 25000
Public txtModel, txtVIN As String
Public System As Object
Public Sess3 As Object
Public Sessions As Object
Public g_HostSettleTime As Integer
Public OldSystemTimeout As Integer
Public Found1st As String
Public ChkSign As String
Public CHKCURSOR
Public Row As Integer
Public Col As Integer
Public Length As Integer
Public SignIn As String
Public CKBAL As String
Sub Autpen()
Dim Id As String
Dim Ps As String
' this is used only when setting up the master file
' run this only at the begining of the promotion
' Get the main system object
Set System = CreateObject("EXTRA.System")
If (System Is Nothing) Then
MsgBox "Could not create the EXTRA! System object. Aborting macro playback.", 48, "DateCapture"
Stop
End If
Set Sessions = System.Sessions
If (Sessions Is Nothing) Then
MsgBox "Could not create the Session object. Stopping macro playback."
End
End If
'Set Sess3 = Sessions.Open("Session3.EDP")
Set Sess3 = GetObject("c:\program files\e!pc\sessions\Session1.EDP")
If (Sess3 Is Nothing) Then
MsgBox "Could not create the Session object. Stopping macro playback."
End
End If
System.TimeoutValue = 2000
Found1st = Sess3.Screen.WaitForString("WELCOME TO NISSAN", 2, 21)
If Found1st Then
End If
' Set the default wait timeout value
g_HostSettleTime = 2000 ' milliseconds
OldSystemTimeout = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Sets the Session to minimized and visible
If Not Sess3.Visible Then Sess3.Visible = True
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
'Checks and Sets the session to the opening screen
ChkSign = Sess3.Screen.GetString(2, 21, 17)
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
If ChkSign <> "WELCOME TO NISSAN" Then
'clear the screen and restart
Sess3.Screen.SendKeys ("<CLEAR>")
'Check to see if the system clock is busy
If BusyClock(Sess3.Screen) = 1 Then
Exit Sub
End If
Sess3.Screen.SendKeys ("<Pf12>")
'Check to see if the system clock is busy
If BusyClock(Sess3.Screen) = 1 Then
Exit Sub
End If
End If
'Checks the cursor to see if it is ready for entry
CHKCURSOR = Sess3.Screen.WaitForCursor(24, 7)
' Enters information to get to the sign on screen
Id = "xxxxxxxx"
Ps = "xxxxxxxxx"
If CHKCURSOR Then
Sess3.Screen.SendKeys ("pmac<Enter>")
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(1, 2)
If CHKCURSOR Then
Sess3.Screen.SendKeys ("<Enter>")
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(4, 14)
If CHKCURSOR Then
Sess3.Screen.SendKeys ("" & Id & "<NewLine>")
Sess3.Screen.SendKeys ("" & Ps & "<Enter>")
Sess3.Screen.WaitHostQuiet (g_HostSettleTime)
End If
CkSign = Sess3.Screen.GetString(7, 20, 19)
If CkSign <> "SIGN-ON IS COMPLETE" Then
' Stop
Else
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(1, 2)
If CHKCURSOR Then
Sess3.Screen.SendKeys ("LV00 <Enter>")
' Check to see if the system clock is busy
If BusyClock(Sess3.Screen) = 1 Then
Exit Sub
End If
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(20, 48)
If CHKCURSOR Then
Sess3.Screen.SendKeys ("01turtle<Enter>")
' Check to see if the system clock is busy
If BusyClock(Sess3.Screen) = 1 Then
Exit Sub
End If
End If
CHKCURSOR = Sess3.Screen.WaitForCursor(21, 23)
End Sub
Function BusyClock(MyScreen As Object) As Integer
'Function to loop the Constant "Max" number of times until the system clock " & _
is no longer busy (0) or exceeds "Max" (1)
For counter = 1 To Max
counter = counter + 1
If MyScreen.OIA.XStatus = 0 Then
BusyClock = 0
Exit Function
End If
Next
MsgBox ("The System Timed Out.")
BusyClock = 1
End Function