Message Box with ok and cancel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I code a message box with an OK and Cancel? I only know how to do a
Message box with and OK. I want to place this message box command on a 'on
change event'. Thanks.
 
All I can offer is a sample of running code:

If IsMissing(yr) Then
DonStmtsYr = InputBox _
("Please enter the applicable 4-character year.", _
"Yearly Donation Statement(s)")

If DonStmtsYr = "" Then Exit Sub 'User clicked cancel
 
How do I code a message box with an OK and Cancel? I only know how to do a
Message box with and OK. I want to place this message box command on a 'on
change event'. Thanks.

In the Change event?
The change event fires each time you enter a character.
Is that what you want?
Perhaps use the BeforeUpdate or AfterUpdate event.
It depends upon what you are trying to do.

If MsgBox("This is the message text", vbOKCancel) = vbOK then
'Do the OK thing here.
Else
'Do the Cancel thing here
End If
 
Back
Top