ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Close file without saving (https://www.excelbanter.com/excel-programming/332421-re-close-file-without-saving.html)

Mike

Close file without saving
 
Hi,
I'm having problems with this one. I am entering your second code in "this
workbook" after other code. The application display alerts is still showing
the "do you want to save" screen and I'm getting an error message when I put
in - this workbook. close savechanges: = false
Any ideaqs ?
Mike

"Jarek" wrote:


Hi,

Private Sub Auto_Close()
ThisWorkbook.Saved = True 'does not save the workbook, only marks it
as saved
ThisWorkbook.Close False
End Sub

or

Private Sub Auto_Close()
Application.DisplayAlerts = False 'to eliminate prompt "Do you want
to save?"
ThisWorkbook.Close SaveChanges:=False
End Sub


Jarek


--
Jarek
------------------------------------------------------------------------
Jarek's Profile: http://www.excelforum.com/member.php...nfo&userid=965
View this thread: http://www.excelforum.com/showthread...hreadid=319815



Chris

Close file without saving
 
hi.i'm only starting to learn this, but try calling the next macro before the
end of your first macro...

like before "end sub", type "call (your macro name)"

learned it from joel... thanks joel

"Mike" wrote:

Hi,
I'm having problems with this one. I am entering your second code in "this
workbook" after other code. The application display alerts is still showing
the "do you want to save" screen and I'm getting an error message when I put
in - this workbook. close savechanges: = false
Any ideaqs ?
Mike

"Jarek" wrote:


Hi,

Private Sub Auto_Close()
ThisWorkbook.Saved = True 'does not save the workbook, only marks it
as saved
ThisWorkbook.Close False
End Sub

or

Private Sub Auto_Close()
Application.DisplayAlerts = False 'to eliminate prompt "Do you want
to save?"
ThisWorkbook.Close SaveChanges:=False
End Sub


Jarek


--
Jarek
------------------------------------------------------------------------
Jarek's Profile: http://www.excelforum.com/member.php...nfo&userid=965
View this thread: http://www.excelforum.com/showthread...hreadid=319815




All times are GMT +1. The time now is 01:12 PM.

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