Debugging Code
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
VBA provides several debugging tools that help analyze how code operates and help locate errors in your code. There is no magic to properly debugging your code and no correct series of steps that always leads to the discovery of errors. Instead, there are some very powerful tools that let you closely examine what is happening in your code so that you can figure out where and when things are going wrong.
This section covers some of the tools you will use repeatedly when debugging your code. You may need to know exactly where an error occurs in a series of nested procedure calls or when a variable is being changed from one value to another. The tool that works best will depend on what you are trying to accomplish.
For more information about debugging VBA code in general, search the Visual Basic for Applications Reference Help index for "debugging" and "debugging code."