I've got a weird situation with a macro that I'm not sure how to go about debugging. This is all within Excel 2007.
From time to time (i.e., not always), the macro fails at a point where I first load a workbook and then immediately save it as an
Excel 2003 file. And it fails by crashing Excel.
Here's the weird part: if I single-step through the macro it never fails. In other words, there's nothing wrong with the logic.
This feels like some kind of file system dependency coupled to a hidden asynchronous behavior in Excel. Like the file load isn't
complete but the macro "thinks" it is and continues on.
I tried inserting Application.Wait <delay 5 seconds> into the flow, but that didn't prevent the crashes.
How the heck do I debug something that works in the debugger but fails in use??
- Mark
In cases like that I've added a Stop to the code, saved the workbook and
opened it. If I get to the Stop I know the problem is after it so I moved
it ahead and tried again. Eventually you should find the line that fails.
You might even be able to figure out why<g>.

Signature
Jim
| I've got a weird situation with a macro that I'm not sure how to go about debugging. This is all within Excel 2007.
|
[quoted text clipped - 11 lines]
|
| - Mark
Mark Olbert - 05 Mar 2008 18:35 GMT
Good idea...but, great ghu, what an ugly thing to have to do.
- Mark
>In cases like that I've added a Stop to the code, saved the workbook and
>opened it. If I get to the Stop I know the problem is after it so I moved
>it ahead and tried again. Eventually you should find the line that fails.
>You might even be able to figure out why<g>.