MsgBox

  • Thread starter Thread starter Keith
  • Start date Start date
K

Keith

I would like to create a msgbox that gives the user the
option of continuing with the code or canceling out of
the code. I am using the following:

MsgBox "Do you want to continue?", vbOKCancel

However, no matter if I click on the "yes" or "cancel"
button, the code continues. What am I doing wrong?
Thanx.
 
You need to read the value of the message box and do something with it:

If vbCancel = MsgBox("Do you want to continue?", vbQuestion + vbOKCancel, _
"Continue?") Then Exit Sub
 
Ken is sending you down the right path. In your code
window, click on the word "Msgbox" and press your F1 key.
This should bring you to Msgbox in the VBA Help file.
Read through this, and take a close look at the Example
for some additional guidance.
 
Back
Top