0

I found this code (link below) very useful but is it possible to suppress compile error msgboxes and also capture the compile errors somehow?

Can I compile VBA on workbook open?

For example I am currently reloading common modules in a list of workbooks. The compile code runs after dynamically reloading all the modules into each file, before moving on to the next file. I get a series of msgboxes within VBA Editor, I have to click OK for each box, but I can't stop the code at that point.

Ideally, I want to be able to halt (or pause) mid-process and take action within the file to correct the errors, before continuing with the process and updating the modules in the remaining files.

Is this possible?

Community
  • 1
  • 1
baldmosher
  • 114
  • 9
  • 1
    If you get msgboxes just press CTRL+Pause to halt the code. This will pop up the typical debug dialog as soon as you close the msgbox. But how are you even able to execute code if there is a compile error? – Leviathan May 05 '16 at 09:45
  • Ah, I begin to understand: You are dynamically loading vba modules on runtime, some of them not being compilable. If you try to compile them on runtime anyways you get error messages that cannot be caught by `On Error` statements. If this is what you mean, can you please update the question so it is more clear? – Leviathan May 05 '16 at 09:51
  • That sounds like what I'm doing, yes. Editing now – baldmosher May 05 '16 at 09:53
  • 1
    No, you can't trap compile errors with code. – Rory May 05 '16 at 10:24
  • That CTRL+Pause trick worked like a charm, thanks Leviathan! – baldmosher May 05 '16 at 11:18

0 Answers0