0

I am building a excel sheet with some few programming on _Activate, _Change, _SelectionChange, etc...

as I am developing, I put breakpoints in vba, after once the code is stopped, VBa doesn't come alive again, after I close and reopen completely excel

even closing workbook and reopening doesn't work if another book is open.

I try with BREAK (pause button), with RESET (square one), nothing seems to reset it

But if I try manually to run something (i.e. PLAY in a sub with no parameter, it works)

Look like excel is not sending events to VBA once stooped once.

Does' it get angry or something similar?

Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
pGrnd2
  • 514
  • 1
  • 5
  • 14
  • 3
    Do you have `Application.EnableEvents = False` somewhere in your code? – DecimalTurn Sep 19 '19 at 15:57
  • Looks very very much like application events are disabled. Ctrl+G to bring up the immediate pane, then type `Application.EnableEvents = True` and hit enter. Then modify your code so that all execution paths restore the global `Application` state before an event handler exits. – Mathieu Guindon Sep 19 '19 at 16:29
  • 3
    `Does' it get angry or something similar?` Yes! To please the VBA God, use proper error handling and switch off/on events as shown [HERE Point 2/3](https://stackoverflow.com/questions/13860894/why-ms-excel-crashes-and-closes-during-worksheet-change-sub-procedure/13861640#13861640) And if you manually pause the code then ensure you switch the events back on as mentioned by @MathieuGuindon above. – Siddharth Rout Sep 19 '19 at 16:37
  • yes, I have some Application.EnableEvents = False , thanks, – pGrnd2 Sep 20 '19 at 10:11
  • I made a macro with Application.EnableEvents = True, I run manually, and 95% times it works, not sure about the other 5% (aprox, I have still re-open excel twice, but not sure yet the reason) – pGrnd2 Sep 20 '19 at 10:12
  • great post , Siddhart, thanks, interesting reading. In a short of way, yes, vba get easily offended, ;-) – pGrnd2 Sep 20 '19 at 10:13

0 Answers0