My Excel file had a load of macros and now when I click Developer - Macros, they don't show up in the list, the list is empty. How do I fix?
Hi this has 100% worked for me in all situations, if it is a macro file (in my case at least).
Open the file in protected mode (usually I save it on the share network so it prompts me to "Enable Content"). You must make sure you're in protected mode so no macros/libraries are activated.
DON'T ENABLE CONTENT
Go to Developer, Visual Basic, then click on "Debug" and click on "Compile VBA Project".
Save the file -- > Close - - > Reopen.
I have seen this happen multiple times, and eventually found a fairly easy solution. To first summarize the problem, we have an excel workbook with macros. After saving and latter reopening the workbook, the macros are no longer there. Even selecting alt F11 ,fails to show any macros, even though macros are enabled in trust center. The solution which has worked for me each time is to simply do the following. Copy the Excel file to a thumb drive, and then open on a different computer. When the file opens, you will see an option at the top of the worksheet to Enable Functions. Click yes. At this point you can click alt F11 to verify that your macros are there. Assuming they are (this has worked for me every time), simply save the file, and then save back to your original location. When you open the workbook yur macros will be visible. Good luck, and keep Excelling.
I had this same issue, but I was not able to open the modules in the VBA editor. I solved it by emailing a copy to myself, then opening it from outlook (with macros disabled). Then I compiled the VBA and saved it. The macros are back :)
Tried to do the "Compile VBA" method. Got as far as opening in protected view but the option to "Compile VBA" was not available (grayed out).
What worked for me, was going to "Open" and instead of "Open in Protected View" I selected "Open and Repair". Was a bit worried this might break something and connections might not be reformed correctly, but have not seen any issues yet and Macro list is populated again.
As far as root cause, not sure if this is what caused the issue in the first place, but I noticed that this type of issue happens when multiple people are editing a shared server file at the same time. On one instance, all of my macros disappeared not only form the macro list but from VBA developer as well. I had to revert to a backup file.
An even easier solution that has also worked for me 100% of the time is to open the file normally, and instead of clicking “enable content,” use shortcut alt f11 to open the VBA window. You should see your macros, save the file and reopen and “enable content” should work fine.
Surprisingly easy way to get it back. Without the file open, right click on it. Click on RESTORE PREVIOUS VERSIONS It'll give you a list of previous days copies. Just try opening one of the ones from a previous day that the macro worked. The missing macro appeared in one of those for me when I opened it.
Permanent fix which worked for me where other methods didn't.
Credit to James Howard here -> here
"I think I perhaps found an answer in this MSDN thread:
Per that thread:
the cause is that Excel does not correctly save the compile state of the VBA code and 64 bit Excel cannot recover from that issue when opening the afflicted Excel file (32 bit usually can). A fix was released for only Excel 2016 and not for other versions
That would indeed confirm that it is a bug within Excel and explains why we only see the issue with 365 64-bit Excel.
That also explains why my manual compile fix works. Based on the article I found, there is a more sustainable fix. You can change Excel’s registry and force VBA to compile accurately.
To implement the permanent fix:
- Open the start menu and type “reg” and select the “Registry Editor”
- Navigate to:
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Excel\options
- On the Edit menu, point to New, and then click DWORD Value.
- Type
ForceVBALoadFromSource
, and then press Enter. - In the Details pane, right-click ForceVBALoadFromSource, and then click Modify.
- In the Value data box, type 1, and then click OK."
© 2022 - 2024 — McMap. All rights reserved.