View Single Post
 
Old 06-30-2020, 01:58 PM
68Monkey 68Monkey is offline Windows 10 Office 2016
Novice
 
Join Date: Jun 2018
Posts: 10
68Monkey is on a distinguished road
Default Where did my VBA code go?

Hello. I ran into a problem last week with a .docm file I was working on and I wonder if anyone might have some idea as to how to resolve the problem.
First of all, I keep this particular .docm file on OneDrive in Office Online. I don't know if this may have contributed to the problem, but I have recently read admonitions on various online forums that all coding should be done on a local drive (although no explanation as to why has been given in any of the posts I've read), so I thought I should mention this fact.

Last week, as I was working on this file, a Windows message popped up on my screen stating that it needed to update. As I was closing the .docm file so I could allow Windows to update, I received a message that the changes to the file could not be merged and that I should save the file as a copy or with a different name. I saved the file with a new name and closed Word.

After the Windows update had been completed and I had rebooted my machine, when I tried to return to the .docm file to work on it, the document opened, but all of the VBA code was (and, obviously, continues to be) inaccessible; in addition, the document doesn't even appear in the Visual Basic Editor, which I find to be very curious. I do periodically save the file with a new name (and keep the older versions of my work) and, interestingly, the file size of my .docm file is similar to the earlier files (leading me to believe that the code is still in the file somewhere). Moreover, when I click on "Macros" in the Developer tab, I do see the names of the macros in the file, but if I select a macro and click "Edit," nothing happens. I tried to restore the previous versions of the document in Windows Explorer (I had last saved it with a new name 8 days earlier and had worked on it quite a bit since saving it with this new name), but--again, quite curiously--there is no version history to be found, other than the date on which I first saved/created this file.

If worse comes to worse, I can go back to the previously-named file (from 8 days earlier) and try to recreate the work I did, but I obviously don't want to have to do that. Does anyone have any idea how to retrieve/restore the code from this file? Perhaps equally as important, does anyone know why this would have happened and what I can do to avoid this problem in the future? Any assistance would be greatly appreciated. Thank you.

Last edited by Charles Kenyon; 07-02-2020 at 12:38 PM. Reason: separate paragraphs
Reply With Quote