Step Through Code if Private Sub

  • Thread starter Thread starter ryguy7272
  • Start date Start date
R

ryguy7272

My code is like this:
Private Sub CallQuery_Click()
....'lotsa stuff
End Sub

I had a heck of a time debugging something today because I couldn't step
through the code like module-code. Finally got it! I could probably debug
it much quicker if I could have stepped through the code. Is there a way to
do this in a Private Sub like the above?

Thanks!
Ryan--
 
hi,

I had a heck of a time debugging something today because I couldn't step
through the code like module-code. Finally got it! I could probably debug
it much quicker if I could have stepped through the code. Is there a way to
do this in a Private Sub like the above?
Set a break boint on the first line containing no declarative code and
step through it. Take a look at the Debug menu.

http://msdn.microsoft.com/en-us/library/aa189086(office.10).aspx


mfG
--> stefan <--
 
With the mouse click in the grey bar just before where you want to start
debugging. A brown dot will appear. From that point on you can step through
the code by pressing the F8 key. Like stefan mentioned there are various
options to use in debug mode. B pressing F9 you can remove the breakpoint.
 
Thanks Stefan and Maurice. I tried your recommendation and this technique
worked fine on two functions in my project. However, I could F8-through the
code even w/out applying the break points. On the two Private Subs in my
project, I still can't F8-through the code, even with the breakpoints in
there. Shift+F8 is disabled and Ctrl+Shift+F8 is disabled too. Any thoughts?
 
hmm weird, beacuse you should be able to step through the code. Is it
possible for you to change the code? In that case typ the word "stop" without
the quotes and try again. The code will stop at the word stop and that line
will be yellow at breaktime. From that point on you should be able to step
through with F8. Don't know why you aren't able to step through the other
functions. There has to be something specific that makes it not 'steppable'.
 
hi,

Thanks Stefan and Maurice. I tried your recommendation and this technique
worked fine on two functions in my project. However, I could F8-through the
code even w/out applying the break points. On the two Private Subs in my
project, I still can't F8-through the code, even with the breakpoints in
there. Shift+F8 is disabled and Ctrl+Shift+F8 is disabled too. Any thoughts?
You can only step through methods directly when they are located in a
standard module. Otherwise when the code is in a form module or class
module you need to initialize the form or the class first.


mfG
--> stefan <--
 
Thanks Stefan! You hit the nail on the head there. I added a break point
near the start of the code; then added a stop down a bit. Since this is a
CallQuery_Click(), I had to click the button to trigger the click-event and
that started the code firing. I was fine after that.
Ryan---
 
Back
Top