Excel – How to prevent Excel from modifying the file on exit

microsoft excelversion control

Whenever I open an Excel file and then close it without changing anything, the Excel would modify the file without asking a permission or giving any kind of warning. It modifies just 4 bytes at offset 0x046C, and I suspect this might be just the hard-coded last-modified time or something like that.

The problem is that this really screws up the versioning control system, since the file's MD5 sum changes.

Is there any way to stop Excel from doing this? As far as I can see there are no links of formulas or any other dynamic elements in the file.

Best Answer

  • I had the same problem, and after several hours reading through several forums and pages I found the root cause of the problem and solution, so I’ll be copy&pasting my answer on the forums I read.

    There seems to be an issue with excel files, in particular Excel 2003 xls files, whenever they get opened in Excel, even if they don't get changed and don't get saved, Excel automatically updates some of the file's metadata, such as the "Document Properties and Personal Information" and "Last Accessed Statistics", therefore the file every time it gets opened changes a little bit, and this makes that the MD5 changes also.

    Solution:

    One way to avoid this problem is to remove document properties and personal information.

    To remove the hidden data and personal information from Office documents, in Excel 2007 and for Excel 2013/2010.

    Other way to avoid this would be to use .xlsx files. I have been trying to replicate this behavior in .xlsx files, but it seems to only happen on .xls (2003) files.