Share via

VBE debugger doesn't stop within class methods?

Anonymous
2011-08-18T15:45:38+00:00

I started creating my own class.  I'm finding that when a bug is encountered, the VBE debugger does not stop and point to the problem within a class method.  It always stops at the point where the class method is called.  I then have to proceed with execution by stepping into the class method at the point where it is invoked via an object.  Some of the methods are quite large, and stepping into them in order to step through the code is just not very practical.

Is it normal behaviour for the debugger to not stop within class methods?  Is there a switch or some kind of circumstance that affects this?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2011-08-18T21:03:46+00:00

In VBA, go to the Tools menu, choose Options, and then the General tab. There, change the error handling option to "Break In Class Module". This will cause the debugger to take you to the line that is causing the error within the class, rather than the line that instantiated the class. You should always use this option. I can't think of any reason to do otherwise.

Was this answer helpful?

4 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Anonymous
2011-08-18T16:32:47+00:00

In the VBE select Tool | Options | General tab. Select Break on all unhandled errors. If you want you can try the other options to see what the differences are.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2011-08-18T21:15:19+00:00

    Thanks Jim and Chip. That was the answer.

    On a somewhat related note, I find that setting Application.DisplayAlerts=False sometimes sends the single-stepping debugger into a tailspin, ending up in completely nonsensical nether regions of code.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-08-18T16:25:19+00:00

    Actually, the problem goes beyond just having the grind through vast amount of code execution to get to the failure point.  By stepping into the class method, I'm starting the execution of the method all over again.  I'm not really replicating the exact conditions of the initial point of failure.

    Was this answer helpful?

    0 comments No comments