View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default close workbook without saving or promt to save

In Thisworkbook module of your workbook.

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

Note you have to save at least once before closing first time or you will
lose the code your just pasted into the module.


Gord Dibben MS Excel MVP

On Wed, 3 Feb 2010 17:57:01 -0800, ATVNSHANE
wrote:

i am new to excel 2007 and when closing the only visible sheet in my workbook
i need it to close the workbook without offering option to save. i have tried
to use macros but i dont think im doing it correctly. i have a active button
that works but i would like it to work when you close from the top right x or
exit excel button.

shane