View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Charles Williams Charles Williams is offline
external usenet poster
 
Posts: 968
Default Preventing "save changes" dialog box???

Yup, sounds like that would work better than the shadow copy method:

Set global to false at workbook open

in Worksheet change
- set global to true if A1:J20 modified
- if global is false (a1:J20 has not been modified since last Save) then set
..Saved to true

At workbook save set global to false

Charles
___________________________________
The Excel Calculation Site
http://www.decisionmodels.com

"Robert Crandal" wrote in message
...
Good catch on that flaw in the code...

As an alternative to the idea that you mention below, how about if
I create a global variable named something like "gWasModified"
and set it to false. If anything in A1:J20 is modified at any time,
then I could set "gWasModified" to true. In the worksheet deactivate
routine, couldn't I just check the global variable and then
set "ThisWorkbook.Saved" to true or false based on my global variable???

(I hope that makes sense, haha)

"Charles Williams" wrote in message
...
If the user changes something in A1:J20 and then changes something
outside a1:j20 .Saved will be True but shouldnt be.

One more complicated way of handling this would be to maintain a hidden
shadow copy of A1:J20 somewhere which gets updated at each Save.
Then you could check in the Worksheet_Change event to see if the shadow
copy matched the real copy, and only set .saved to True if they matched.