ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   msgbox cancel? (https://www.excelbanter.com/excel-discussion-misc-queries/220343-msgbox-cancel.html)

sycsummit

msgbox cancel?
 
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...



Jim Thomlinson

msgbox cancel?
 
if msgbox("Are you sure", vbyesno) = vbyes then
msgbox "Do Something"
else
msgbox "you selected no so nothing will happen"
endif
--
HTH...

Jim Thomlinson


"sycsummit" wrote:

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



sycsummit

msgbox cancel?
 
thanks!

"Jim Thomlinson" wrote:

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

Jim Thomlinson


"sycsummit" wrote:

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




All times are GMT +1. The time now is 12:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com