Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Has an Excel Workbook been changed?

Status
Not open for further replies.

hyarmion

Technical User
Dec 23, 2008
20
AU
Using Excel 2003, can I detect if the open workbook has been changed in the BeforeClose method. i.e something like:

if activeworkbook.hasbeenchanged then
<do something>
else
<do something else, probably nothing>
end if

Thanks, Steve.


 
Is this a normal workbook or a shared workbook?

What would you be doing if any changes had been made?

HarleyQuinn
---------------------------------
Carter, hand me my thinking grenades!

You can hang outside in the sun all day tossing a ball around, or you can sit at your computer and do something that matters. - Eric Cartman

Get the most out of Tek-Tips, read FAQ222-2244: How to get the best answers before post
 
The property you are looking for is .Saved (which will hold the opposite boolean value to your hypothetical .HasBeenChanged property)
 
This is a normal workbook, not a shared workbook.
 
Yes, thanks, it did better than help, it gave me a whole new idea on how to approach the problem: Instead of adding my code to the BeforeClose method and worrying about whether the workbook had been saved or not, I just added my code into the BeforeSave method. That way my code executed every time the workbook was saved, which is precisely what I wanted. Thanks for your help, and my apologies for not thanking you earlier.

Steve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top