Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
is it possible to disable "save" prompt in excel file on web server? | Excel Discussion (Misc queries) | |||
Disallow "SAVE" only "SAVE AS" or prompt | Setting up and Configuration of Excel | |||
"save changes" prompt missing | Excel Discussion (Misc queries) | |||
Close without "Do you want to save changes" prompt | Excel Programming | |||
How can I get "File Close" to prompt me to "Save Changes" ?? | Excel Programming |