Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Make sure that the excel file is still the same

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Make sure that the excel file is still the same

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Make sure that the excel file is still the same

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Make sure that the excel file is still the same

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Make sure that the excel file is still the same

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Make sure that the excel file is still the same

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make Lable in Excel from a xls file shyam saran Excel Discussion (Misc queries) 1 June 11th 06 03:14 PM
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? Starriol Excel Programming 0 November 3rd 05 11:59 AM
in a excel file, how to make a menu item for the .xls file that when clicked on it runs myform.show? example plz Daniel Excel Worksheet Functions 1 July 7th 05 03:52 AM
How to make one CSV file from two Excel sheets? Marek L. Excel Discussion (Misc queries) 3 February 13th 05 07:47 PM
How to I make a back up file in excel. balindy Excel Discussion (Misc queries) 2 January 12th 05 05:05 PM


All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"