Phantom Breakpoints

I had a horrific Excel 2003 crash today. When I restarted Excel and opened any workbooks – including locked xla’s – which had been open during the crash, I found that they were riddled with phantom breakpoints. I’ve seen the occasional phantom breakpoint before, but never on this scale.

So what is a phantom breakpoint? A phantom breakpoint is a term people use to describe a situation where they try to run some code and, for no apparent reason, code execution pauses when a certain line is reached – just as it would if you had placed a breakpoint there. The pause in code execution is accompanied by the message “code execution has been interrupted”. When you press F5 to continue code execution, it will happily finish without any complaints (unless it hits another phantom breakpoint). My understanding from participating on online MS Office forums is that phantom breakpoints are more common in MS Access than in MS Excel.

In the past, the reliable fix I’ve used to get rid of the phantom breakpoints is to press CTRL+BREAK. Another less than ideal option is to put Application.EnableCancelKey = xlDisabled at the start of the problematic procedure. My usual solution didn’t work in this case so I tried a whole host of things including clearing xlb files, running Code Cleaner, pressing CTRL+SHIFT+F9 as suggested here and various other tweaks – all to no avail.

I also have Excel 2007 installed on the same box and I found that the workbooks had the same problem when I opened them in that.  In the end I rebooted my PC and the problem disappeared, so the cause must be a temporary file which is communal across versions. Any ideas?


About Colin Legg

RAD Developer Microsoft MVP - Excel 2009 - 2014
This entry was posted in Microsoft Excel, Microsoft Office and tagged , , . Bookmark the permalink.

4 Responses to Phantom Breakpoints

  1. I’ve had my share of these, and I *HATE* them! While I use Ctrl + Shift + F9 frequently (as I love breakpoints), I think it has more to do with available memory allocation than anything else, although perhaps you’re onto something with the temporary files. On occasion, closing Excel down fully, then re-opening will fix the problem, but sometimes it gets so bad I have to restart the whole computer, which finally clears the errors.

    While I haven’t been able to nail down the exact cause of it, the procedures I run when this happens is almost always memory-intensive, and is always when I have either stepped through or broke to a section of code. If I don’t do that (for the entire session), these problems never come up. I use 2010 and 2013 side-by-side.


  2. Jeff Weir says:

    Hi Colin. I had some of these recently, and found that running the CleanProject VBA addin from AppsPro fixed the issue. No idea what caused it in the first place.


  3. numcrun says:

    “In the past, the reliable fix I’ve used to get rid of the phantom breakpoints is to press CTRL+BREAK.”

    Worked for me. Thanks.


  4. Olivier says:

    My solution :

    1 – copy all the module code,
    2 – paste it in a new module,
    3 – delete old module from project,
    4 – rename new module same name than the old one.

    It works every time.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s