close workbook without saving or promt to save

  • Thread starter Thread starter ATVNSHANE
  • Start date Start date
A

ATVNSHANE

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
 
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
 
i used alt f11 and add module, enter code. exit back to worksheet and saved
then close. when i went back in it still promt to save when closing. is that
the correct place to enter code?
 
Back
Top