ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto_Close (https://www.excelbanter.com/excel-programming/365359-auto_close.html)

JohnUK

Auto_Close
 
Hi,
Because my workbook does a lot of work before closing down, if someone was
to press Cancel on the Save dialogue box it really messes things up.
Is there a way in which maybe the Cancel can not be shown and be left with
the Yes and No instead?
Regards
John


Jim Jackson

Auto_Close
 
ThisWorkbook.Close (SaveChanges = True) ' will avoid the dialog box and thus
help prevent problems.

Best wishes,

Jim

"JohnUK" wrote:

Hi,
Because my workbook does a lot of work before closing down, if someone was
to press Cancel on the Save dialogue box it really messes things up.
Is there a way in which maybe the Cancel can not be shown and be left with
the Yes and No instead?
Regards
John


JohnUK

Auto_Close
 
Hi Jim,
After a bit of trying & testing I finaly got this to work.
Many thanks - Greatly Appreciated
Regards
John
PS I did try changing the True to False but for some reason that didnt want
to know

Msg = "Save changes to Workbook?"
Style = msoAlertButtonYesNo + vbCritical + vbDefaultButton1
Title = "SAVE WORKBOOK?"
Ctxt = 1000
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then
ActiveWorkbook.Save
ThisWorkbook.Close (SaveChanges = True)
Else
ThisWorkbook.Close (SaveChanges = True)
End If

"Jim Jackson" wrote:

ThisWorkbook.Close (SaveChanges = True) ' will avoid the dialog box and thus
help prevent problems.

Best wishes,

Jim

"JohnUK" wrote:

Hi,
Because my workbook does a lot of work before closing down, if someone was
to press Cancel on the Save dialogue box it really messes things up.
Is there a way in which maybe the Cancel can not be shown and be left with
the Yes and No instead?
Regards
John



All times are GMT +1. The time now is 10:41 AM.

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