View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Apparently not possible?

I assume the workbook is being closed manually, since you are trying to use
the before close and before save methods to indicate the file is saved to
reject changes.
Otherwise, the ThisWorkbook.Saved = True would work if entered just before
the close command in code. For some reason, it won't work in the before
close/save execution. You might be able to work around it by putting a close
button on the toolbar and close the file by code each time. Then it should
work.

"XP" wrote:

Office 2003 and Win XP;

I have a normal XLS file which runs hidden (Window-Hide). This file is run
from a toolbar. This hidden file does things to other files from the toolbar
and in the process some data gets written into the hidden file, but it is
only needed temporarily.

The hidden file is shared, so it is set to open read only by default using
file properties. Apparently, it is not possible to code this file so when a
user closes MS-Excel the hidden file will close itself without warnings,
without messages, and without saving? i.e. just drop dead, quietly?

I have tried all manner of the following in either and both the Before_Close
and Before_Save events:

Cancel = True
Application.EnableEvents = False
Application.DisplayAlerts = False
ThisWorkbook.Saved = True
ThisWorkbook.Close SaveChanges:= False

No matter what I try, I ALWAYS get the save file question. If not
impossible, please tell me how it can be done.

Thanks much in advance from a very frustrated user.