Chapter 15. Debugging VBA Procedures

     

In this chapter

  • Trapping and handling program errors.

  • Simple yet effective strategies for trapping errors and debugging procedures.

  • Debugging a procedure by pausing program execution.

  • Stepping through a procedure one statement at a time.

  • Monitoring the values of variables , properties, and expressions.

  • Tips for debugging and creating error-free code.

It's usually easy to get short Sub and Function procedures up and running. However, as your code grows larger and more complex, errors inevitably creep in. Many of these errors ”programmers call them bugs ”will be simple syntax problems you can fix easily, but others will be more subtle and harder to find. For the latter ”whether the errors are incorrect values being returned by functions or problems with the overall logic of a procedure ”you'll need to be able to look "inside" your code to scope out what's wrong. The good news is that VBA gives you several reasonably sophisticated debugging tools that can remove some of the burden of program problem solving. This chapter looks at these tools and shows you how to use them to help recover from most programming errors.



Absolute Beginner's Guide to VBA
Absolute Beginners Guide to VBA
ISBN: 0789730766
EAN: 2147483647
Year: 2003
Pages: 146

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net