Excel VBA debugger stops without error or warning

前端 未结 1 1483
挽巷
挽巷 2021-01-25 20:50

While trying to test some code, I am having an issue that I don\'t recall running into before. When I step through the code it halts after the ClearContents line...there is no

相关标签:
1条回答
  • 2021-01-25 21:26

    Postmortem on this issue seems to lead to the conclusion that this was in fact a corrupted Excel file. Luckily I had a fairly recent back up as well. However, in order to save the time that had been spent coding between that backup and the corrupted version, here are the steps I took to save the file, in case anyone else encounters the strange behavior I did:

    1. Closed all Excel windows and started a fresh instance without opening a file.
    2. Used Ctrl+O to search for the file...but instead of just clicking Open, click the down arrow and select Open & Repair.
    3. Click Repair
    4. Saved as a new copy *-Repaired (just because).

    After this, the file ran as expected. The circular reference in the EOMONTH function went away and the debugger ran as expected. I have run full testing on all code and it is working normally.

    I have no explanation as to how it became corrupted, just lucky I guess.

    See https://support.office.com/en-us/article/Repairing-a-corrupted-workbook-e5b49891-dde7-4796-b60a-49b0d2478a62 for other options when dealing with corrupted Excel files.

    EDIT: This issue came back again and what currently has it working was forcing Windows Updates. The system is set on Automatic, but when I manually went and checked, it found 3 Office updates. After installing those, I ran Windows Update again and found another update for .Net framework...so I did that as well...doubt that had any effect...but...

    So...after using Excel's Open & Repair, applying updates and restarting a couple of times, turning on Break on all errors...my code is finally working again all the way through.

    0 讨论(0)
提交回复
热议问题