VBA code missing from Excel Workbook

Anonymous
2021-09-03T12:07:26+00:00

Hi Microsoft community,

I have been working on a macro-enabled workbook. Today when opening the sheet, I get this error for each module:

After pressing "ok" for each "missing module" I get this error:

When accessing Visual Basic I can se the modules in the project explorer, but they are all empty?

I have selected the "BiomassSetup" module in the picture below:

If the file can't be fixed, is it then possible to get my code back?

Hope that you guys can help. It's approximately a weeks coding I'm missing...

Microsoft 365 and Office | Excel | For home | 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
{count} votes

6 answers

Sort by: Most helpful
  1. OssieMac 47,981 Reputation points Volunteer Moderator
    2021-09-04T03:31:37+00:00

    Have a look at the following link and see if it helps. Note that it is a non Microsoft site but is a popular site for Excel Users.

    https://www.ozgrid.com/forum/index.php?thread/1203639-vba-window-shows-list-of-modules-but-does-not-show-any-code/

    0 comments No comments
  2. OssieMac 47,981 Reputation points Volunteer Moderator
    2021-09-04T03:47:09+00:00

    Also try the "Reset" button that I have marked with the red enclosure on the following Screen Shot. The code might be stalled somewhere due to an error in event code that runs when the workbook opens.

    0 comments No comments
  3. Anonymous
    2021-09-06T06:40:26+00:00

    Thank you Ossie Mac. Do you know what is ment with the "I go to vb code screen and write in Stop in first line of workbook open procedure". I find this part confusing.

    0 comments No comments
  4. Anonymous
    2021-09-06T06:45:25+00:00

    I tried this. But this wasn't the issue. I noticed that the file went from 450 kb to 6 Mb later that day. The file was definetly corrupt. I had the file on sharepoint, but all previeous versions had the same error. Then at the end of the day, I accessed the sharepoint through my browser, and downloaded a version. This version worked. I have no idea of what happened... Thank you for your help! I'm always learning and am greatful for the link you send. I'm definitetly gonna check out the forum.

    Best regards,

    0 comments No comments
  5. OssieMac 47,981 Reputation points Volunteer Moderator
    2021-09-06T07:01:46+00:00

    Do you know what is meant with the "I go to vb code screen and write in Stop in first line of workbook open procedure". I find this part confusing.

    It was assuming that you have a workbook Open event. The Stop simply stops the code from continuing to run past that point. The VBA editor should open with the Stop line highlighted. If you click the Reset button then that stops all of the code and the workbook has then opened without the Workbook Open code running.

    However, if you now have a downloaded version of the workbook with the code running satisfactorily then corrupted workbook is more likely the problem you were having.

    0 comments No comments