View Single Post
  #4   Report Post  
Dana DeLouis
 
Posts: n/a
Default

Just throwing out an idea. If you open certain workbooks often, and know
that you do not want to save changes, perhaps add something like this to the
"ThisWorkbook" module:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True
End Sub

When this workbook is closed, Excel will think that the data has been saved,
and won't prompt to save anything.
Another option to throw out. In Personal.xls, I have a class module that
intercepts the closing of all workbooks. If the workbook has a certain
document property set, the macro will set the saved property to true. For
example, a certain template imports data, and generates reports, When I
click close, I do not want this saved (I would run the macro again for more
current data). I would add a document property to this template that tells
the closing macro not to bother saving changes. Again, just an idea.
--
Dana DeLouis
Win XP & Office 2003


"JohnUK" wrote in message
...
Thanks Dana, I will give this a go. The problem I have is
that a few of my workbooks run macro's automaticaly when
opened, and because i am working on a project that brings
in 12 workbooks information into one, I dont want them to
save the changes, hence the wanting to change the
defaults. I am sure this would also help me in other
projects also.
Many thanks again
John
-----Original Message-----
If I am not mistaken, when you "save" a document, the

changes will be saved.
However, when you "close" a document, you have the

option of saving changes
or not.

Workbooks("BOOK1.XLS").Close SaveChanges:=False ' or True

You may want to look at the "Saved" property also.
You can fake excel into thinking the workbook was saved,

then close it.

ThisWorkbook.Saved = True
ThisWorkbook.Close

I hope I understood the question correctly.
--
Dana DeLouis
Win XP & Office 2003


"JohnUK" wrote in

message
...
When saving a document using VBA it would always

default
to either saving with changes or without (as an

example)
What do I enter into the code that would force it into
doing otherwise?
Many thanks in advance
John



.