Message still appears with DisplayAlerts = False & SaveChanges:=Fa

W

wpiet

In an Excel 2003 macro, I have 3 workbooks, each of which I close with this
code:

ActiveWindow.Close SaveChanges:=False

This has run for months without incident but now, in each instance, pops up
a form entitled "Document modified," with the prompt:
"The active document has been changed. Save Changes?"

So, I added, before the Close method: "Application.DisplayAlerts = False".

The message still appears when it hits the Close.

The macro was originally written in Excel 2003 & all the workbooks invloved
are Excel 97-2003 .xls files.
However, I am now using Excel 2007, though the primary user of the workbooks
& the macro is still using 2003.

I had made some changes to the macro through my Excel 2007. It had the .xls
open in Compatibility Mode & I saved it as .xls format, not 2007 .xlsm.
Windows Explorer shows it as file type "Excel 97-2003 Worksheet."

Is there something in the 2003 - 2007 relationship that might cause this
problem?

Thanks,
Will
 
W

wpiet

Thanks, Simon. That took care of it.
Any idea why that was popping up, when it never had before in all the months
it's been running?
--
Will


Simon Lloyd said:
If you are not saving changes then you can also add this line:
VBA Code:
--------------------

Activeworkbook.Saved=TRUE

--------------------



Excel will think it has already been saved and you should not be
alerted.



In an Excel 2003 macro, I have 3 workbooks, each of which I close with
this
code:

ActiveWindow.Close SaveChanges:=False

This has run for months without incident but now, in each instance,
pops up
a form entitled "Document modified," with the prompt:
"The active document has been changed. Save Changes?"

So, I added, before the Close method: "Application.DisplayAlerts =
False".

The message still appears when it hits the Close.

The macro was originally written in Excel 2003 & all the workbooks
invloved
are Excel 97-2003 .xls files.
However, I am now using Excel 2007, though the primary user of the
workbooks
& the macro is still using 2003.

I had made some changes to the macro through my Excel 2007. It had the
.xls
open in Compatibility Mode & I saved it as .xls format, not 2007 .xlsm.
Windows Explorer shows it as file type "Excel 97-2003 Worksheet."

Is there something in the 2003 - 2007 relationship that might cause
this
problem?

Thanks,
Will


--
Simon Lloyd

Regards,
Simon Lloyd
'Excel Chat' (http://www.thecodecage.com/forumz/chat.php)
------------------------------------------------------------------------
Simon Lloyd's Profile: 1
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=184739

Excel Live Chat

.
 

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