Had this recuring problem that after doing some work my excel file came up with the error "document not saved". Just managed to fix it so i thought i'd share it here.

This solution may work for you if like me you have a userform (in vba) that uses a RefEdit control.

Open the file, but disable macros.

Delete the RefEdit control (unfortunately my fix is you do without it).

In vba go tools>references. You may have a reference that is prefixed MISSING. Uncheck the reference.

Save the file (with macros disabled you should be able to do this).

Go back in, this time enabling macros and you should not have the problem again