Step Thru Code?

  • Thread starter Thread starter croy
  • Start date Start date
C

croy

When I'm looking at my code in the code window, I can't seem
to make the code run.

If I click on the Run button, a dialog pops up, asking what
Macro I want to run.

If I click on the StepThru button, nothing seems to happen.

What am I missing?
 
When I'm looking at my code in the code window, I can't seem
to make the code run.

If I click on the Run button, a dialog pops up, asking what
Macro I want to run.

If I click on the StepThru button, nothing seems to happen.

What am I missing?

Put a breakpoint in your code. Either click on the grey area left of
your code, or Right-click, Toggle, Breakpoint. This will put a red
circle in the grey area, turn the line of code white with a red
background.

Now start your code. Push the button that calls it, or open the
immediate window (Ctrl-G) and type the name of the Subroutine and hit
enter or type PRINT and then the name of the function and hit enter.

Your code will start executing, and it will stop at the breakpoint you
set. Your code is actually running, it's just paused. If you hover
over a variable, it will give you the current value. This is useful
when debugging loops.

After you've stopped, F8 will single step through the code, F5 will
run full speed until it comes to the end of the function/sub or it
hits another breakpoint.

Hope this helps,
Chris M.
 
When I'm looking at my code in the code window, I can't seem
to make the code run.

If I click on the Run button, a dialog pops up, asking what
Macro I want to run.

If I click on the StepThru button, nothing seems to happen.

What am I missing?

It depends upon where the code is placed.
If the code is in a Module, place the cursor anywhere within the
procedure. Click on the Run (or a step through) tool button and the
code will run (or step through).

However, if the code is in a class module (attached to a form or
report), first place a code break inside the procedure. Then run the
procedure from however you would normally run it, i.e. Click a
command button. The code will stop and the code window will appear at
the break.
 
When I'm looking at my code in the code window, I can't seem
to make the code run.

If I click on the Run button, a dialog pops up, asking what
Macro I want to run.

If I click on the StepThru button, nothing seems to happen.

What am I missing?


Thanks to both Chris and Fred for their help. I'm on my way
:-)
 
Back
Top