Debugger

L

Leigh Clow

Hi,

I'm having a problem with macros where if I record a macro and then run it
and it encounters an error it gives me an option to Debug and highlights the
error. This however is not happening with macros written from scratch,
there's just an error messgae and the OK and Help button. Can someone please
tell me how to enable the Debug option in scratch written macros? Thanks.

-Leigh Clow
 
C

Chris Roth [MVP]

Hi LC

You can put your cursor at the top of the macro and hit F8 to step through
line by line. Or you can highlight any line of code and hit F9 to toggle
breakpoints on and off. The code should stop at breakpoint lines.

It sounds like you may have a "compile error" in your code, whereby VBA
won't even execute the first line of your code, because something is illegal
(like a variable declared twice...?) and needs to be fixed before you can
even start stepping through the code.

You might also try (in VBA) the Debug > Compile menu item to see if VBA can
show you where the problem is.

--
Hope this helps,

Chris Roth
Visio MVP

Free Visio shapes:
http://www.visguy.com/category/shapes
Visio programming info:
http://www.visguy.com/category/programming/
Other Visio resources:
http://www.visguy.com/visio-links/
 
L

Leigh Clow

Hi Chris,

I've tried the Debug-compile method before and it didn't show me where the
error was but I haven't tried breakpoints so I'll do that next. Thanks.

-Leigh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top