msgbox cancel?

S

sycsummit

I have a snippet of code attached to a clickable button that emails a
workbook to a specified address. However, I would like a confirmation box to
pop up asking for confirmation before this action is taken. I've gotten as
far as:

Dim response As Long
response = MsgBox(prompt:="Are you sure you would like to submit?",
Buttons:=vbOKCancel)

Now, when OK is clicked, the form executes as it should. But, if I click
cancel, the button still executes. How do I program it to do nothing and
return to the form I was just using, taking no action, if cancel is clicked?
Thanks...
 
J

Jim Thomlinson

if msgbox("Are you sure", vbyesno) = vbyes then
msgbox "Do Something"
else
msgbox "you selected no so nothing will happen"
endif
 
S

sycsummit

thanks!

Jim Thomlinson said:
if msgbox("Are you sure", vbyesno) = vbyes then
msgbox "Do Something"
else
msgbox "you selected no so nothing will happen"
endif
 

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