Share via

All VBA code vanished from a macro-enabled Excel workbook (Office 365)

Anonymous
2021-09-02T13:30:52+00:00

I'm experiencing the exact same problem as in this thread:
Macros Disappeared in Macro-Enabled Workbook Excel 2016 - Microsoft Community

Yesterday a .xlsm file with VBA code was working just fine, and 12 hours later all the VBA code had vanished. The workbook had not been saved as .xlsx -- it remained .xlsm the whole time. The users of this workbook do not know how to access the code, so they did not go in and delete it.

The file in question is stored in SharePoint 2016. However, I had a backup copy on a network drive that hasn't been touched since June 2021. I opened it up last night and it too was missing all the code. But then shortly thereafter (after closing and re-opening) the code appeared again. But unfortunately the copy stored in SharePoint remains broken (the VBA code is still all missing).

I can get it working again, but I need to understand what caused this to happen in the first place so I can prevent it from happening again.

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2021-09-04T03:54:01+00:00

    Hi kandiyohivwork,

    May I know if you have update information regarding to this issue? Feel free to post back if you need further assistance.

    Best Regards,

    Waqas Muhammad

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2021-09-03T02:11:34+00:00

    Hi kandiyohivwork,

    As per your description, this is really abnormal behavior as you encounter. This might be a different cause and it very hard to find an exact root cause of this issue.

    As you mentioned, “I had a backup copy on a network drive that hasn't been touched since June 2021. I opened it up last night and it too was missing all the code.” may I know does issue happened to only specific Excel Macro “.xlsm” file workbook? If the issue only happens to a specific file, the file may be corrupted somehow. In this scenario try to copied and pasted the code into other workbooks and see if there is any difference.

    If the issue happens to all Excel “.xlsm” file including a new created one stored in your SharePoint 2016 server or in your network drive, the issue is more related to the Office app itself or your computer environment. You can first try suggestions below to see the result:

    1. Make sure you’ve updated Office to the latest version that some issues can be resolved with such method.
    2. Try open your Excel insafe mode which allow you to safely use it when it has encountered certain problems
    3. If still can’t work, please try torepair an Office application to fix the problem.

    In the meantime, I can’t reproduce the issue in version 2108 (14326.20238) Current channel. To confirm whether this is a bug in a specific version, please provide us the version information. To check version: Open any Office e.g., Excel>File>Account>Product Information and capture a full screenshot and share here (Please mask your private message for protecting your private message) and we will be tested on that version and verify the result with you.

    I appreciate your understanding and stay safe!!

    Best Regards

    Waqas Muhammad

    Was this answer helpful?

    0 comments No comments