How do I start: Debug - Step Into

Dale Logan
Dale Logan used Ask the Experts™
on
I am trying to fix an application built by someone else that creates and exports several graphs and charts into Excel. It's having a problem with a couple of charts by copying over the data for the chart with data that should go somewhere else. A long time ago I knew how to "Step Into" the code, but can't get it to do anything now. I want to watch what the code does one line at a time.

How do I start Step Into? Right now when I select it from the Debug menu, nothing happens.

Once the first question is answered, what will I need to do to go from line to line? Spacebar, F8, ???

Also, for the user to begin the Export process he clicks on a button. There are a couple of lines that run before calling CreateExcelWorkbook. Where should I start the Step Into?

Thanks, Dale
Private Sub btnExport_Click()

    Me.optView.Value = 2
    Call HandleView
    Call TableRequery
  
  Call CreateExcelWorkbook
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
this is a simpler way of doing the step in to codes

Private Sub btnExport_Click()
 Stop    '<<<< Add this, remove later whenyou are done
    Me.optView.Value = 2
    Call HandleView
    Call TableRequery
   
  Call CreateExcelWorkbook
End Sub


the code will halt in the "stop", press F8  to move to the next line of code



Top Expert 2016

Commented:
you can do this too, by clicking on the place indicated by the arrow
the code will stop where you place a breakpoint, just clear them when you are done with

Debug> clear all breakpoints

you can more info by typing "debugging" in the VBA help
StepInto.jpg
Scott McDaniel (EE MVE )Infotrakker Software
Most Valuable Expert 2012
Top Expert 2014

Commented:
Or place your cursor in the line of code where you want debugging to start and press F9.

Cap's given you some specific advice regarding this, but I'd encourage you to look into all the features of the VBA debugger, like Watches and such. This allows you to really get specific with the various methods available for debugginng in the VBA IDE.

Here's a good article on using the various methods: http://msdn.microsoft.com/en-us/library/ee358847.aspx

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial