How to NOT save changes on exit? Before_close?


Posted by Patrick on August 09, 2001 1:18 PM

Good morning!
I read a CSV file into a SS. I never want to save that data. I'm trying to make the SS not ask to save changes. I'd like my users to hit the 'X' like normal and have the SS close without saving anything and no questions asked! I'm new to VBA, not programming.

In the "ThisWorkbook" section of my project manager, I try this code to no avail:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.DisplayAlerts = False
End Sub

Yet it still asks me to save? (Which I manually saved after I added this code!)

Any suggestions?
XL2000, Win98SE
Thanks bunches,
Pat

Posted by Barrie Davidson on August 09, 2001 2:42 PM

Pat, how are you reading the CSV file in to Excel? Are you using a macro to open the CSV file, manipulate the file, and then close it?

Barrie



Posted by Jim on August 09, 2001 4:13 PM

In your This Workbook module:
Private Sub Workbook_BeforeClose()
This Workbook.Saved =True
Jim