Ok, let's try this one more time, the last modification would not work correctly with all possible punch lines. I rewrote the last if statement, but could not get it to work until I noticed that the PrevUserSent variable has a leading space added to it, so I've used a mid statement to elimintate the leading space to make the equation parses correctly. Does this work for everyone or is my particular setup adding the leading space?
'Response to a knock knock joke
PrevUserSenta = Mid(PrevUserSent, 2, 100)
If Instr (1, UserSentence, "Knock knock", VbTextCompare) > 0 Then
GetResponse = "Who is there?"
End If
If Instr (1, PrevSent, "Who is there", VbTextCompare) > 0 Then
GetResponse = UserSentence & " " & "who?"
End If
If Instr (1, PrevSent, " who", VbTextCompare) > 0 And Instr (1, PrevSent, PrevUserSenta, VbTextCompare) > 0 Then
Knock = (Rnd * 100)
If Knock < 25 Then GetResponse = "HAHAHAHAaaaa that's a good one!"
If Knock > 24 And Knock < 50 Then GetResponse = "Ha Ha very funny"
If Knock > 49 And Knock < 75 Then GetResponse = "That was quite amusing"
If Knock > 74 And Knock < 101 Then GetResponse = "That was bad, I wouldn't quit your day job"
End If