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!

Unable to close out my code 1

Status
Not open for further replies.

Kuljack

Technical User
May 15, 2014
11
US
Hello, A few weeks back I received some great assistance from Remy here. Since then I've been playing with my code to expand on my needs but have hit another wall. The error appears to be with the End Sub. I believe it has to do with my if statements not being closed properly but I am unable to figure out the solution. Please assist!


Code below:

'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
' Session Document: "CPI.edp"
' Date: Friday, May 16, 2014 13:41:10
' User: krwrigh
'--------------------------------------------------------------------------------

' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$

Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System 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 = 200 ' milliseconds

OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If

' Get the necessary Session Object
Dim Sess0 As Object
Set Sess0 = System.ActiveSession
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)

' This section of code contains the recorded events


'button group/icon group/default group


'Buttons Value
'OK only 0
'OK, Cancel 1
'Abort, Retry, Ignore 2
'Yes, No, Cancel 3
'Yes, No 4
'Retry, Cancel 5

'Icons Value
'Critical Message (Stop sign) 16
'Warning Query (Question mark ) 32
'Warning Message (Exclamation) 48
'Information Message (lower-case i) 64

'this sets the default button
'Button Defaults Value
'First button 0
'Second button 256
'Third button 512


'Value Button Pressed
'1 OK
'2 Cancel
'3 Abort
'4 Retry
'5 Ignore
'6 Yes
'7 No



msgtex = "Is this an inbound call?"
answer1 = MsgBox(msgtex, 4 + 48 + 512, "Compliance Tool")

If answer1 = "6" Then

msgtex = "Are you speaking to a third party"
answer2 = MsgBox(msgtex, 4 + 32 + 256, "Compliance Tool")


if answer2 = "6" Then
Sess0.Screen.Sendkeys("<Home>mem1<Enter>")
MsgBox"Verify all A3P/Attorney contacts in MEM1"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>saf1<Enter>")
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"Verify the cease and desist code"
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
MsgBox"Verify customer name, property address, mailing address, and last four of social security number. Also look for cease and desist banner as well"
msgbox"Review mancode to read appropriate disclaimer and recording script"
Sess0.Screen.Sendkeys("<Home>dlq8<Enter>")
MsgBox"Verify all contact numbers on the account"
Sess0.Screen.Sendkeys("<Home>for1<Enter>")

msgtex = "Is the foreclosure active?"
answer3 = MsgBox(msgtex, 4 + 48 + 512, "Foreclosure Status")

If answer3 = "6" Then
MsgBox"Verfiy foreclosure status, click okay to continue"
Sess0.Screen.Sendkeys("<Home>for3<Enter>")
MsgBox"Review for U20, click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

Else
If answer3 = "7" Then
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmt3<Enter>")
MsgBox"Review for a populated L14. If blank, solicit payment per hierarchy"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

End if

Else
if answer2 = "7" Then
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
MsgBox"Verify customer name, property address, mailing address, and last four of social security number. Also look for cease and desist banner as well"
Sess0.Screen.Sendkeys("<Home>mem1<Enter>")
MsgBox"Verify all A3P/Attorney contacts in MEM1"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>saf1<Enter>")
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"Verify the cease and desist code"
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
msgbox"Review mancode to read appropriate disclaimer and recording script"
Sess0.Screen.Sendkeys("<Home>dlq8<Enter>")
MsgBox"Verify all contact numbers on the account"
Sess0.Screen.Sendkeys("<Home>for1<Enter>")


msgtex = "Is the foreclosure active?"
answer3 = MsgBox(msgtex, 4 + 48 + 512, "Foreclosure Status")

If answer3 = "6" Then
MsgBox"Verfiy foreclosure status, click okay to continue"
Sess0.Screen.Sendkeys("<Home>for3<Enter>")
MsgBox"Review for U20, click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

Else
If answer3 = "7" Then
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmt3<Enter>")
MsgBox"Review for a populated L14. If blank, solicit payment per hierarchy"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

End if

Else

If answer1 = "7" Then

msgtex = "Are you speaking to a third party"
answer5 = MsgBox(msgtex, 4 + 48 + 256, "Compliance Tool")


if answer5 = "6" Then
Sess0.Screen.Sendkeys("<Home>mem1<Enter>")
MsgBox"Verify all A3P/Attorney contacts in MEM1"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>saf1<Enter>")
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"Verify the cease and desist code"
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
MsgBox"Verify customer name, property address. Also look for cease and desist banner as well"
msgbox"Review mancode to read appropriate disclaimer and recording script"
Sess0.Screen.Sendkeys("<Home>dlq8<Enter>")
MsgBox"Verify all contact numbers on the account"
Sess0.Screen.Sendkeys("<Home>for1<Enter>")

msgtex = "Is the foreclosure active?"
answer6 = MsgBox(msgtex, 4 + 48 + 256, "Foreclosure Status")

If answer6 = "6" Then
MsgBox"Verfiy foreclosure status, click okay to continue"
Sess0.Screen.Sendkeys("<Home>for3<Enter>")
MsgBox"Review for U20, click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

Else
If answer6 = "7" Then
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmt3<Enter>")
MsgBox"Review for a populated L14. If blank, solicit payment per hierarchy"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")



Else
if answer5 = "7" Then
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
MsgBox"Verify customer name, property address. Also look for cease and desist banner as well"
Sess0.Screen.Sendkeys("<Home>mem1<Enter>")
MsgBox"Verify all A3P/Attorney contacts in MEM1"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>saf1<Enter>")
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"Verify the cease and desist code"
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
msgbox"Review mancode to read appropriate disclaimer and recording script"
Sess0.Screen.Sendkeys("<Home>dlq8<Enter>")
MsgBox"Verify all contact numbers on the account"
Sess0.Screen.Sendkeys("<Home>for1<Enter>")

msgtex = "Is the foreclosure active?"
answer7 = MsgBox(msgtex, 4 + 48 + 256, "Foreclosure Status")

If answer7 = "6" Then
MsgBox"Verfiy foreclosure status, click okay to continue"
Sess0.Screen.Sendkeys("<Home>for3<Enter>")
MsgBox"Review for U20, click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

Else
If answer7 = "7" Then
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmt3<Enter>")
MsgBox"Review for a populated L14. If blank, solicit payment per hierarchy"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")






System.TimeoutValue = OldSystemTimeout

End Sub
 
Code:
If [i]expression[/i] Then

Else

End If

Where are your [highlight #FCE94F]End Ifs[/highlight]???

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Here is the code with the End Ifs where I thought they should rest, but I haven't quite mastered nesting with this code. Thank you for your help!

msgtex = "Is this an inbound call?"
answer1 = MsgBox(msgtex, 4 + 48 + 512, "Compliance Tool")

If answer1 = "6" Then

msgtex = "Are you speaking to a third party"
answer2 = MsgBox(msgtex, 4 + 32 + 256, "Compliance Tool")


if answer2 = "6" Then
Sess0.Screen.Sendkeys("<Home>mem1<Enter>")
MsgBox"Verify all A3P/Attorney contacts in MEM1"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>saf1<Enter>")
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"Verify the cease and desist code"
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
MsgBox"Verify customer name, property address, mailing address, and last four of social security number. Also look for cease and desist banner as well"
msgbox"Review mancode to read appropriate disclaimer and recording script"
Sess0.Screen.Sendkeys("<Home>dlq8<Enter>")
MsgBox"Verify all contact numbers on the account"
Sess0.Screen.Sendkeys("<Home>for1<Enter>")

msgtex = "Is the foreclosure active?"
answer3 = MsgBox(msgtex, 4 + 48 + 512, "Foreclosure Status")

If answer3 = "6" Then
MsgBox"Verfiy foreclosure status, click okay to continue"
Sess0.Screen.Sendkeys("<Home>for3<Enter>")
MsgBox"Review for U20, click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

Else
If answer3 = "7" Then
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmt3<Enter>")
MsgBox"Review for a populated L14. If blank, solicit payment per hierarchy"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")


End if
End if

Else
if answer2 = "7" Then
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
MsgBox"Verify customer name, property address, mailing address, and last four of social security number. Also look for cease and desist banner as well"
Sess0.Screen.Sendkeys("<Home>mem1<Enter>")
MsgBox"Verify all A3P/Attorney contacts in MEM1"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>saf1<Enter>")
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"Verify the cease and desist code"
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
msgbox"Review mancode to read appropriate disclaimer and recording script"
Sess0.Screen.Sendkeys("<Home>dlq8<Enter>")
MsgBox"Verify all contact numbers on the account"
Sess0.Screen.Sendkeys("<Home>for1<Enter>")



msgtex = "Is the foreclosure active?"
answer3 = MsgBox(msgtex, 4 + 48 + 512, "Foreclosure Status")

If answer3 = "6" Then
MsgBox"Verfiy foreclosure status, click okay to continue"
Sess0.Screen.Sendkeys("<Home>for3<Enter>")
MsgBox"Review for U20, click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

Else
If answer3 = "7" Then
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmt3<Enter>")
MsgBox"Review for a populated L14. If blank, solicit payment per hierarchy"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

End if
End if


Else

If answer1 = "7" Then


msgtex = "Are you speaking to a third party"
answer5 = MsgBox(msgtex, 4 + 48 + 256, "Compliance Tool")


if answer5 = "6" Then
Sess0.Screen.Sendkeys("<Home>mem1<Enter>")
MsgBox"Verify all A3P/Attorney contacts in MEM1"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>saf1<Enter>")
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"Verify the cease and desist code"
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
MsgBox"Verify customer name, property address. Also look for cease and desist banner as well"
msgbox"Review mancode to read appropriate disclaimer and recording script"
Sess0.Screen.Sendkeys("<Home>dlq8<Enter>")
MsgBox"Verify all contact numbers on the account"
Sess0.Screen.Sendkeys("<Home>for1<Enter>")

msgtex = "Is the foreclosure active?"
answer6 = MsgBox(msgtex, 4 + 48 + 256, "Foreclosure Status")

If answer6 = "6" Then
MsgBox"Verfiy foreclosure status, click okay to continue"
Sess0.Screen.Sendkeys("<Home>for3<Enter>")
MsgBox"Review for U20, click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

Else
If answer6 = "7" Then
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmt3<Enter>")
MsgBox"Review for a populated L14. If blank, solicit payment per hierarchy"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

End if
End if

Else
if answer5 = "7" Then
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
MsgBox"Verify customer name, property address. Also look for cease and desist banner as well"
Sess0.Screen.Sendkeys("<Home>mem1<Enter>")
MsgBox"Verify all A3P/Attorney contacts in MEM1"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>saf1<Enter>")
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"Verify the cease and desist code"
Sess0.Screen.Sendkeys("<Home>dlq1<Enter>")
Sess0.Screen.Sendkeys("<Home><Tab><Tab>mort<Enter>")
msgbox"Review mancode to read appropriate disclaimer and recording script"
Sess0.Screen.Sendkeys("<Home>dlq8<Enter>")
MsgBox"Verify all contact numbers on the account"
Sess0.Screen.Sendkeys("<Home>for1<Enter>")



msgtex = "Is the foreclosure active?"
answer7 = MsgBox(msgtex, 4 + 48 + 256, "Foreclosure Status")

If answer7 = "6" Then
MsgBox"Verfiy foreclosure status, click okay to continue"
Sess0.Screen.Sendkeys("<Home>for3<Enter>")
MsgBox"Review for U20, click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")

Else
If answer7 = "7" Then
Sess0.Screen.Sendkeys("<Home>lmt1<Enter>")
MsgBox"Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
Sess0.Screen.Sendkeys("<Home>lmt3<Enter>")
MsgBox"Review for a populated L14. If blank, solicit payment per hierarchy"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Pf8>")
MsgBox"click okay to continue"
Sess0.Screen.Sendkeys("<Home>lmtn<Enter>")


End if
End if


System.TimeoutValue = OldSystemTimeout

End Sub
 
hi,
the key is for every If, there is an End If.

you should re-write your code, one End If at a time while inserting Else.

use the indents to help you view the beginning of the If and the end of the End if

Code:
Sub main()
    If answer = 6 Then
    
        If answer = 7 Then
        
        Else
            If answer = 8 Then
            
            End If
        
        End If
    
    Else
        If answer = 7 Then
            If answer = 9 Then
            
            End If
        End If
    End If
End Sub

if you paste your code into a VBA module, it may be easier.

also, the logic in the code is
 
Code:
Sub main()
    Dim Sessions As Object
    Dim System 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 = 200 ' milliseconds
    
    OldSystemTimeout& = System.TimeoutValue
    If (g_HostSettleTime > OldSystemTimeout) Then
       System.TimeoutValue = g_HostSettleTime
    End If
 
' Get the necessary Session Object
    Dim Sess0 As Object
    Set Sess0 = System.ActiveSession
    If (Sess0 Is Nothing) Then
        MsgBox "Could not create the Session object. Stopping macro playback."
        Stop
    End If
    If Not Sess0.Visible Then Sess0.Visible = True
    Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
    msgtex = "Is this an inbound call?"
    answer1 = MsgBox(msgtex, 4 + 48 + 512, "Compliance Tool")

    If answer1 = "6" Then
    
        msgtex = "Are you speaking to a third party"
        answer2 = MsgBox(msgtex, 4 + 32 + 256, "Compliance Tool")
    
        If answer2 = "6" Then
            Sess0.Screen.SendKeys ("<Home>mem1<Enter>")
            MsgBox "Verify all A3P/Attorney contacts in MEM1"
            Sess0.Screen.SendKeys ("<Pf8>")
            MsgBox "click okay to continue"
            Sess0.Screen.SendKeys ("<Pf8>")
            MsgBox "click okay to continue"
            Sess0.Screen.SendKeys ("<Pf8>")
            MsgBox "click okay to continue"
            Sess0.Screen.SendKeys ("<Home>saf1<Enter>")
            Sess0.Screen.SendKeys ("<Pf8>")
            MsgBox "Verify the cease and desist code"
            Sess0.Screen.SendKeys ("<Home>dlq1<Enter>")
            Sess0.Screen.SendKeys ("<Home><Tab><Tab>mort<Enter>")
            MsgBox "Verify customer name, property address, mailing address, and last four of social security number. Also look for cease and desist banner as well"
            MsgBox "Review mancode to read appropriate disclaimer and recording script"
            Sess0.Screen.SendKeys ("<Home>dlq8<Enter>")
            MsgBox "Verify all contact numbers on the account"
            Sess0.Screen.SendKeys ("<Home>for1<Enter>")

            msgtex = "Is the foreclosure active?"
            answer3 = MsgBox(msgtex, 4 + 48 + 512, "Foreclosure Status")

            If answer3 = "6" Then
                MsgBox "Verfiy foreclosure status, click okay to continue"
                Sess0.Screen.SendKeys ("<Home>for3<Enter>")
                MsgBox "Review for U20, click okay to continue"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Home>lmt1<Enter>")
                MsgBox "Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
                Sess0.Screen.SendKeys ("<Home>lmtn<Enter>")

            Else
                If answer3 = "7" Then
                    Sess0.Screen.SendKeys ("<Home>lmt1<Enter>")
                    MsgBox "Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
                    Sess0.Screen.SendKeys ("<Home>lmt3<Enter>")
                    MsgBox "Review for a populated L14. If blank, solicit payment per hierarchy"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Home>lmtn<Enter>")


                End If
            End If

        Else
            If answer2 = "7" Then
                Sess0.Screen.SendKeys ("<Home>dlq1<Enter>")
                Sess0.Screen.SendKeys ("<Home><Tab><Tab>mort<Enter>")
                MsgBox "Verify customer name, property address, mailing address, and last four of social security number. Also look for cease and desist banner as well"
                Sess0.Screen.SendKeys ("<Home>mem1<Enter>")
                MsgBox "Verify all A3P/Attorney contacts in MEM1"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Home>saf1<Enter>")
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "Verify the cease and desist code"
                Sess0.Screen.SendKeys ("<Home>dlq1<Enter>")
                Sess0.Screen.SendKeys ("<Home><Tab><Tab>mort<Enter>")
                MsgBox "Review mancode to read appropriate disclaimer and recording script"
                Sess0.Screen.SendKeys ("<Home>dlq8<Enter>")
                MsgBox "Verify all contact numbers on the account"
                Sess0.Screen.SendKeys ("<Home>for1<Enter>")
 
                msgtex = "Is the foreclosure active?"
                answer3 = MsgBox(msgtex, 4 + 48 + 512, "Foreclosure Status")

                If answer3 = "6" Then
                    MsgBox "Verfiy foreclosure status, click okay to continue"
                    Sess0.Screen.SendKeys ("<Home>for3<Enter>")
                    MsgBox "Review for U20, click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Home>lmt1<Enter>")
                    MsgBox "Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
                    Sess0.Screen.SendKeys ("<Home>lmtn<Enter>")

                Else
                    If answer3 = "7" Then
                        Sess0.Screen.SendKeys ("<Home>lmt1<Enter>")
                        MsgBox "Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
                        Sess0.Screen.SendKeys ("<Home>lmt3<Enter>")
                        MsgBox "Review for a populated L14. If blank, solicit payment per hierarchy"
                        Sess0.Screen.SendKeys ("<Pf8>")
                        MsgBox "click okay to continue"
                        Sess0.Screen.SendKeys ("<Pf8>")
                        MsgBox "click okay to continue"
                        Sess0.Screen.SendKeys ("<Pf8>")
                        MsgBox "click okay to continue"
                        Sess0.Screen.SendKeys ("<Home>lmtn<Enter>")

                    End If
                End If
            End If
        End If
    Else
        If answer1 = "7" Then
        
            msgtex = "Are you speaking to a third party"
            answer5 = MsgBox(msgtex, 4 + 48 + 256, "Compliance Tool")
            
            If answer5 = "6" Then
                Sess0.Screen.SendKeys ("<Home>mem1<Enter>")
                MsgBox "Verify all A3P/Attorney contacts in MEM1"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "click okay to continue"
                Sess0.Screen.SendKeys ("<Home>saf1<Enter>")
                Sess0.Screen.SendKeys ("<Pf8>")
                MsgBox "Verify the cease and desist code"
                Sess0.Screen.SendKeys ("<Home>dlq1<Enter>")
                Sess0.Screen.SendKeys ("<Home><Tab><Tab>mort<Enter>")
                MsgBox "Verify customer name, property address. Also look for cease and desist banner as well"
                MsgBox "Review mancode to read appropriate disclaimer and recording script"
                Sess0.Screen.SendKeys ("<Home>dlq8<Enter>")
                MsgBox "Verify all contact numbers on the account"
                Sess0.Screen.SendKeys ("<Home>for1<Enter>")
                
                msgtex = "Is the foreclosure active?"
                answer6 = MsgBox(msgtex, 4 + 48 + 256, "Foreclosure Status")
                
                If answer6 = "6" Then
                    MsgBox "Verfiy foreclosure status, click okay to continue"
                    Sess0.Screen.SendKeys ("<Home>for3<Enter>")
                    MsgBox "Review for U20, click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Home>lmt1<Enter>")
                    MsgBox "Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
                    Sess0.Screen.SendKeys ("<Home>lmtn<Enter>")
                
                Else
                    If answer6 = "7" Then
                    Sess0.Screen.SendKeys ("<Home>lmt1<Enter>")
                    MsgBox "Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
                    Sess0.Screen.SendKeys ("<Home>lmt3<Enter>")
                    MsgBox "Review for a populated L14. If blank, solicit payment per hierarchy"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Home>lmtn<Enter>")
                    
                    End If
                End If
                
            Else
                If answer5 = "7" Then
                    Sess0.Screen.SendKeys ("<Home>dlq1<Enter>")
                    Sess0.Screen.SendKeys ("<Home><Tab><Tab>mort<Enter>")
                    MsgBox "Verify customer name, property address. Also look for cease and desist banner as well"
                    Sess0.Screen.SendKeys ("<Home>mem1<Enter>")
                    MsgBox "Verify all A3P/Attorney contacts in MEM1"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "click okay to continue"
                    Sess0.Screen.SendKeys ("<Home>saf1<Enter>")
                    Sess0.Screen.SendKeys ("<Pf8>")
                    MsgBox "Verify the cease and desist code"
                    Sess0.Screen.SendKeys ("<Home>dlq1<Enter>")
                    Sess0.Screen.SendKeys ("<Home><Tab><Tab>mort<Enter>")
                    MsgBox "Review mancode to read appropriate disclaimer and recording script"
                    Sess0.Screen.SendKeys ("<Home>dlq8<Enter>")
                    MsgBox "Verify all contact numbers on the account"
                    Sess0.Screen.SendKeys ("<Home>for1<Enter>")
                    
                    
                    msgtex = "Is the foreclosure active?"
                    answer7 = MsgBox(msgtex, 4 + 48 + 256, "Foreclosure Status")
                    
                    If answer7 = "6" Then
                        MsgBox "Verfiy foreclosure status, click okay to continue"
                        Sess0.Screen.SendKeys ("<Home>for3<Enter>")
                        MsgBox "Review for U20, click okay to continue"
                        Sess0.Screen.SendKeys ("<Pf8>")
                        MsgBox "click okay to continue"
                        Sess0.Screen.SendKeys ("<Pf8>")
                        MsgBox "click okay to continue"
                        Sess0.Screen.SendKeys ("<Pf8>")
                        MsgBox "click okay to continue"
                        Sess0.Screen.SendKeys ("<Home>lmt1<Enter>")
                        MsgBox "Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
                        Sess0.Screen.SendKeys ("<Home>lmtn<Enter>")
                    
                    Else
                        If answer7 = "7" Then
                            Sess0.Screen.SendKeys ("<Home>lmt1<Enter>")
                            MsgBox "Review status and assigned SPOC, offer to transfer call to SPOC or handle the call. Inform customer you will email the HPS of the call if handled by you"
                            Sess0.Screen.SendKeys ("<Home>lmt3<Enter>")
                            MsgBox "Review for a populated L14. If blank, solicit payment per hierarchy"
                            Sess0.Screen.SendKeys ("<Pf8>")
                            MsgBox "click okay to continue"
                            Sess0.Screen.SendKeys ("<Pf8>")
                            MsgBox "click okay to continue"
                            Sess0.Screen.SendKeys ("<Pf8>")
                            MsgBox "click okay to continue"
                            Sess0.Screen.SendKeys ("<Home>lmtn<Enter>")
                        End If
                    End If
                End If
            End If
        End If
    End If
End Sub

 
Perfect! Thanks Remy - I see where I wasn't making the connection now and it runs perfect
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top