no updates prompt at opening and save changes at closing

S

Shariq

I couldn't find anything in this regard on help menu, but if it is possible
in excel, I'd like to know if I can make a book which when closing shouldn't
ask for save changes or is it really not possible, I'd appreciate any replies
in this regard.

SHARIQ

thanks in advance
 
A

Alan

Only with VBA,
Hit Ctrl an F11 to open the VB editor, double click 'This Workbook' and copy
and paste this code into it,

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ThisWorkbook.Saved = True
End Sub

Bear in mind that if someone opens the workbook with macro's disabled they
can do as they wish. There are ways to overcome that too, but Excel
protection of all kinds is weak and can be easily circumvented.
Regards,
Alan.
 
G

Gord Dibben

Do you want the workbook to close and save or just close without saving?

This code will save the workbook with changes and no prompt.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Save
End Sub

This wiill close with no save and no prompt.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub


Gord Dibben MS Excel MVP
 
Top