Message Box on exiting workbook

C

cufc1210

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
 
M

Mike H

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
 

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