View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Toggling save warning message on or off

Some food for thought...

There's a number of reasons why the alert is displayed when no user
changes have occured. The most common is when cells contain formulas
and CalculationMode is set to Automatic. Excel calcs these on opening
and so considers the file has changed and needs to be saved. Editing
cells is not the only action that can trigger this alert. For example,
if a user expands/collapses an outline a change occured. Actions that
fire certain events can trigger the alert as well.

You could...

...have your XLSM code turn Application.DisplayAlerts off and set
Application.Calculation to xlCalculationManual *before* it opens files.

...add an events handler class to your XLSM that handles all Excel
events and workbook/worksheet events so as to control the behavior of
your project under specific runtime conditions. This is fairly complex
but once the class is set up it's reusable in other projects. This
would be my preference because I can trap any workbook's BeforeClose
event and run my own code regarding a file's 'Saved' state (or any
other condition I choose).

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion