Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All
Is there a good way to test if the excel file hasn't been changed since it was last saved? We thought about computing the hashvalue but we noticed that when the excel file is opened and closed without changing anything it changes its last access date/time and also something inside the datastructure of the file. that destroyes our hashvalue theory... thanks for your help. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A Workbook has a .Saved property just for this; from Help file:
Saved Property True if no changes have been made to the specified workbook since it was last saved. Read/write Boolean. Remarks If a workbook has never been saved, its Path property returns an empty string (""). You can set this property to True if you want to close a modified workbook without either saving it or being prompted to save it. -- - K Dales "Jörgen Ahrens" wrote: Hi All Is there a good way to test if the excel file hasn't been changed since it was last saved? We thought about computing the hashvalue but we noticed that when the excel file is opened and closed without changing anything it changes its last access date/time and also something inside the datastructure of the file. that destroyes our hashvalue theory... thanks for your help. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Upon rereading, I am not sure I understood correctly with my first reply.
That reply assumed you wanted to know if an open workbook had been saved. Are you wanting to know this for a closed workbook file? If so, what could have changed it since it was last saved? -- - K Dales "Jörgen Ahrens" wrote: Hi All Is there a good way to test if the excel file hasn't been changed since it was last saved? We thought about computing the hashvalue but we noticed that when the excel file is opened and closed without changing anything it changes its last access date/time and also something inside the datastructure of the file. that destroyes our hashvalue theory... thanks for your help. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
We have a simple excel-file. We create a copy of it and just open it up with
excel and close it without changing or saving anything. If you then use a binary compare to compare the two files you see differences...and for that we could not use the hash value. we would like to know if the file we open is still the same when we last opened it...and therefore we tought about a hash value...but its not going to work if the file changes even if there is nothing changed inside... we already have an id as a custom Propertie field in the file itself (to uniqly identify the file), but we would like to have more control over it (its easy for a customer to change the custom propertie field) so we thought about a hashvalue... do you know of any other way to do that? thanks for your reply. "K Dales" wrote in message ... Upon rereading, I am not sure I understood correctly with my first reply. That reply assumed you wanted to know if an open workbook had been saved. Are you wanting to know this for a closed workbook file? If so, what could have changed it since it was last saved? -- - K Dales "Jörgen Ahrens" wrote: Hi All Is there a good way to test if the excel file hasn't been changed since it was last saved? We thought about computing the hashvalue but we noticed that when the excel file is opened and closed without changing anything it changes its last access date/time and also something inside the datastructure of the file. that destroyes our hashvalue theory... thanks for your help. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you could save the file with a password to modify:
Under the file|SaveAs|tools menu. Then not share that password with anyone who shouldn't have access to change the file. "Jörgen Ahrens" wrote: We have a simple excel-file. We create a copy of it and just open it up with excel and close it without changing or saving anything. If you then use a binary compare to compare the two files you see differences...and for that we could not use the hash value. we would like to know if the file we open is still the same when we last opened it...and therefore we tought about a hash value...but its not going to work if the file changes even if there is nothing changed inside... we already have an id as a custom Propertie field in the file itself (to uniqly identify the file), but we would like to have more control over it (its easy for a customer to change the custom propertie field) so we thought about a hashvalue... do you know of any other way to do that? thanks for your reply. "K Dales" wrote in message ... Upon rereading, I am not sure I understood correctly with my first reply. That reply assumed you wanted to know if an open workbook had been saved. Are you wanting to know this for a closed workbook file? If so, what could have changed it since it was last saved? -- - K Dales "Jörgen Ahrens" wrote: Hi All Is there a good way to test if the excel file hasn't been changed since it was last saved? We thought about computing the hashvalue but we noticed that when the excel file is opened and closed without changing anything it changes its last access date/time and also something inside the datastructure of the file. that destroyes our hashvalue theory... thanks for your help. -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
So if I now understand, you want to know if someone else (the customer) has
modified the file since the last time you opened it? Perhaps you could do it with a hidden sheet and the Workbook_SheetChange() Event; you could even keep a log on the hidden sheet of any changes made, depending on how much detail you want. But at the very least you could log the user name (Application.UserName) and date/time changed. The following is some basic code that will keep a log of the 1000 most recent changes to a Workbook (in practice I would add routines to detect and properly account for multiple cell/multiple sheet ranges being changed, along with error trapping): Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Dim LogRange As Range With Worksheets("CHANGES") If Not (Sh.Name = "CHANGES") Then Set LogRange = .Range("A1").CurrentRegion If LogRange.Rows.Count = 1000 Then .Range("A1").EntireRow.Delete End If Set LogRange = .Range("A" & .Range("A1").CurrentRegion.Rows.Count + 1) LogRange.Cells(1, 1) = Application.UserName LogRange.Cells(1, 2) = Now() LogRange.Cells(1, 3) = Sh.Name LogRange.Cells(1, 4) = Target.Address LogRange.Cells(1, 5) = "'" & Target.Formula End If End With End Sub -- - K Dales "Jörgen Ahrens" wrote: Hi All Is there a good way to test if the excel file hasn't been changed since it was last saved? We thought about computing the hashvalue but we noticed that when the excel file is opened and closed without changing anything it changes its last access date/time and also something inside the datastructure of the file. that destroyes our hashvalue theory... thanks for your help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to make Lable in Excel from a xls file | Excel Discussion (Misc queries) | |||
How to make a routine that will automatically print a word file after it has been changed via an ole link to an excel file? | Excel Programming | |||
in a excel file, how to make a menu item for the .xls file that when clicked on it runs myform.show? example plz | Excel Worksheet Functions | |||
How to make one CSV file from two Excel sheets? | Excel Discussion (Misc queries) | |||
How to I make a back up file in excel. | Excel Discussion (Misc queries) |