PDA

View Full Version : Solved: Auto Close does not work (tried many ways)



zest1
10-15-2006, 10:12 AM
I'm trying to close a wb without saving, but the following codes will just not work. :confused4

Sub CloseWB()
Application.DisplayAlerts = False
ThisWorkbook.Close
Application.DisplayAlerts = True
End Sub
this doens; work either:

ThisWorkbook.Close SaveChanges:=False

I even tried adding "(0)" after "ThisWorkbook.Close", as in
ThisWorkbook.Close (0), but still nothing.
Any ideas what he problem could be?
thanks

mdmackillop
10-15-2006, 10:39 AM
Sub DoClose()
ThisWorkbook.Close False
End Sub


All your solutions work for me. :dunno

zest1
10-15-2006, 10:49 AM
I just found another alternative code that fortunately works.

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