ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Message Box Prompt (https://www.excelbanter.com/excel-programming/375010-message-box-prompt.html)

yasser

Message Box Prompt
 
I have a code running behind a button which, once pressed, saves the workbook
in a specified directory. Now, I want to give the users the option to cancel
the action.

Therefore, I want a message box that tells the users that if they click on
"OK", the file will be saved in a particular directory, but if they don't
want the file getting saved, they should press "CANCEL".

I want to create a message box which does the following:

If user clicks "OK", the workbook closes.

If user clicks "Cancel", the workbook remains open.

How can I code this?

Thanks, in advance, for your help.

-Yasser

Bob Phillips

Message Box Prompt
 
If MsgBox("OK To Save",vbOKCancel) = vbOK Then
Activeworkbook.Close
End If

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"yasser" wrote in message
...
I have a code running behind a button which, once pressed, saves the

workbook
in a specified directory. Now, I want to give the users the option to

cancel
the action.

Therefore, I want a message box that tells the users that if they click on
"OK", the file will be saved in a particular directory, but if they don't
want the file getting saved, they should press "CANCEL".

I want to create a message box which does the following:

If user clicks "OK", the workbook closes.

If user clicks "Cancel", the workbook remains open.

How can I code this?

Thanks, in advance, for your help.

-Yasser





All times are GMT +1. The time now is 02:15 AM.

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