I don't know what your problem could be. I ran the following, and got the
proper feedback as to what my response was to the Do Action message.
Sub Test()
Dim Date1 As Date
Dim Response As Long
Date1 = Int(Now()) - 1
If Date1 > Date Then
MsgBox "Cancel Action", vbOKOnly
ElseIf Date1 <= Date Then
Response = MsgBox(" Are you sure?", vbYesNoCancel)
If Response = vbNo Then
ElseIf Response = vbYes Then
Response = MsgBox("Do Action", vbYesNoCancel)
If Response = vbNo Then
MsgBox "no"
ElseIf Response = vbCancel Then
MsgBox "cancel"
ElseIf Response = vbYes Then
MsgBox "yes"
End If
End If
End If
End Sub
BTW, you don't really need to parts where you test for something but then
don't do anything, i.e. it could be just
Sub Test()
Dim Date1 As Date
Dim Response As Long
Date1 = Int(Now()) - 1
If Date1 > Date Then
MsgBox "Cancel Action", vbOKOnly
ElseIf Date1 <= Date Then
Response = MsgBox(" Are you sure?", vbYesNoCancel)
If Response = vbYes Then
Response = MsgBox("Do Action", vbYesNoCancel)
If Response = vbYes Then
MsgBox "yes"
End If
End If
End If
End Sub
It's still doing the same. vbNo and Cancel are acting just like vbYes in the
last msg.
Does it work in yours? Maybe I need to clean my wkbk?
If date1 > Date Then
MsgBox "Cancel Action", vbOKOnly
ElseIf date1 <= Date Then
Response = MsgBox(" Are you sure?", vbYesNoCancel)
If Response = vbNo Then
'do nothing
ElseIf Response = vbYes Then
Response = MsgBox("Do Action", vbYesNoCancel)
If Response = vbNo Then
'do nothing
ElseIf Response = vbYes Then
Save....etc.....do the specified action
End If
End If
End If