Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
is it possible to disable "save" prompt in excel file on web server? [email protected] Excel Discussion (Misc queries) 0 May 9th 07 05:58 PM
Disallow "SAVE" only "SAVE AS" or prompt DTTODGG Setting up and Configuration of Excel 6 December 21st 05 03:54 PM
"save changes" prompt missing Dennis Excel Discussion (Misc queries) 0 October 31st 05 04:32 AM
Close without "Do you want to save changes" prompt Paul Excel Programming 1 October 1st 04 02:09 AM
How can I get "File Close" to prompt me to "Save Changes" ?? Charles Jordan Excel Programming 4 July 31st 03 04:01 PM


All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"