close workbook without saving or promt to save

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
 
G

Gord Dibben

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
 
A

ATVNSHANE

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top