View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default 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