View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Roadie[_3_] Roadie[_3_] is offline
external usenet poster
 
Posts: 1
Default Close file without saving


Hi all,

I'm having a problem with closing a file without the message 'Do yo
want to save the changes, Yes/No/Cancel'.
What's my problem? Well, I had a file containing a macro that had t
open a couple of files, one at a time, look for a value in a cell, an
depending on that value, close the file immediately or first perfor
some actions, copy some cells to the mainfile and close the file
Without changes. And then the next file and so on. I had the comman
'Application.DisplayAlerts = False' in the macro and it always worke
without any problems.
I haven't used this macro in a year, but now I want to use this macr
for another Network Drive (another location of the sourcefiles). Thes
files open Read-Only.
However, when I run the macro, I get the message 'Do you want to sav
changes?' when the macro closes a file where some cells are copied an
pasted.

Now, it isn't really a big problem, because I guess it could work i
the macro copies the worksheet first to the mainfile and closes th
sourcefile. Probably then the macro will consider the sourcefile a
not-changed. But before I'm changing the macro, I would like to know i
there's anyone who has experienced the same.

Here's what I've tried so far:
Application.DisplayAlerts = False
ThisWorkbook.Saved = True
Workbooks(sourcefilename).Close SaveChanges:=False

But nevertheless, I still get the 'Change? Yes/No/Cancel'-messages. An
then, it doesn't really matter what option I choose (Yes or No), becaus
Excel doesn't close the file anyway. Since the macro has to handle som
tens/hundreds of files, that's really annoying. Furthermore, the macr
crashes because the activeworkbook is the file that should be closed.
could easily fix that too, I know.

What's really the problem is that I can't stand it that Excel keep
showing the message, even though I put the displayalerts off, an
refuses to close the file. Is it because the files open Read-Only, o
is it that I have another Excelversion? Has anyone of you experience
the same and does anyone know what to do about it?

Regards,

Anne

--
Roadi
-----------------------------------------------------------------------
Roadie's Profile: http://www.excelforum.com/member.php...nfo&userid=593
View this thread: http://www.excelforum.com/showthread.php?threadid=27153