ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Message Box on exiting workbook (https://www.excelbanter.com/excel-discussion-misc-queries/244136-message-box-exiting-workbook.html)

cufc1210

Message Box on exiting workbook
 
I have a spreadsheet where i have a macro that saves and exits the workbook.

when the save & Exit button is pressed is it possible to have a message box
pop up and ask if they are sure they want to exit the workbook. Then when
they select ok it will continue to save and exit.

I hope this makes sense

Mike H

Message Box on exiting workbook
 
Hi,

maybe this

Private Sub Workbook_BeforeClose(Cancel As Boolean)
response = MsgBox("Are you sure you want to quit?", vbYesNo)
If response = vbNo Then
Cancel = True
End If
End Sub

Mike

"cufc1210" wrote:

I have a spreadsheet where i have a macro that saves and exits the workbook.

when the save & Exit button is pressed is it possible to have a message box
pop up and ask if they are sure they want to exit the workbook. Then when
they select ok it will continue to save and exit.

I hope this makes sense



All times are GMT +1. The time now is 05:55 PM.

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