MsgBox

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.
 
K

Ken Snell

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
 
B

Bicman

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top