'Excel 2021 crashes when opening VBA editor and can't load workbooks with macros [closed]

I just recently upgraded to Office 2021 (prof. plus LTSC), and whenever I open the VBA editor on Excel, it crashes after few seconds. Moreover, when I try to open any workbook with macros, I get the following message:

"We found a problem with some content in [...]. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes"

when I click yes, the removed content is always the VBA project " /xl/vbaProject.bin ". It occurs in any macro-enabled file I open.

It also occurs in any new macro-enabled workbook that I create

I tried reinstalling Office 2021 and enabling all macros in any workbook. I guess it has nothing to do with the VBA code but some config in excel or windows 10

Where else can I look? Thanks



Solution 1:[1]

No this has to do with the file you load beeing corrupted (broken) and Office detected that it is corrupted but obviously wasn't able to repair it.

So it is definitely a problem with the file (and not with Office itself) as Office says in the error message.

So what you can do is:

  1. Try opening this file in an old Office version (where it worked before) and save it under a new file name in the binary xlsb format. With some luck this gets the file repaired.
  2. If (1) did not work: Open the file in an old Office Version, start a new file form scratch. Copy over all macros to the new file, copy over all data to the new file and save it under a new file name. Try to open that new clean file in Office 2021 then.
  3. If (2) does not work neither, make sure if creating a new file and copying over the data you copy only values but no formattings.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pᴇʜ