![]() |
invoke "Save Changes?" prompt
Hi everyone,
I would like to invoke the "save changes?" prompt message that normally appears when you are closing a workbook or the application. I've searched through the xlDialogs and can't seem to find the exact prompt - I don't want a prompt that allows SaveAs capability. How can I invoke this dialog in VBA? Thanks in advance guys! |
invoke "Save Changes?" prompt
Hello I Beliieve, Here is macro that recreates the dialog. Another choice would be to add this into your code... ActiveWorkbook.Saved = False Application.Quit HERE'S THE DIALOG IN MACRO FORM... Code: -------------------- Sub SaveChangesPrompt() Dim Answer Answer = MsgBox("Do you want to save the changes you made to '" & ActiveWorkbook.Name & "'?", vbExclamation + vbYesNoCancel) Select Case Answer Case vbYes ActiveWorkbook.Save Case vbNo ActiveWorkbook.Saved = True Application.Quit Case Cancel Exit Sub End Select End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=495627 |
invoke "Save Changes?" prompt
Thanks Leith.
My next problem would have been to capture the user's selection but I can easily do this now with the sub you provided. Cheers! "Leith Ross" wrote: Hello I Beliieve, Here is macro that recreates the dialog. Another choice would be to add this into your code... ActiveWorkbook.Saved = False Application.Quit HERE'S THE DIALOG IN MACRO FORM... Code: -------------------- Sub SaveChangesPrompt() Dim Answer Answer = MsgBox("Do you want to save the changes you made to '" & ActiveWorkbook.Name & "'?", vbExclamation + vbYesNoCancel) Select Case Answer Case vbYes ActiveWorkbook.Save Case vbNo ActiveWorkbook.Saved = True Application.Quit Case Cancel Exit Sub End Select End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=495627 |
All times are GMT +1. The time now is 05:32 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com