![microsoft visual basic for applications view variabes debug microsoft visual basic for applications view variabes debug](https://flylib.com/books/1/101/1/html/2/images/g08vb02.png)
Once a line of code defines a variable, you can hover the mouse over the variable to view its value, as shown in Figure B. Then, press to step through each line of code. To enact step mode, press or choose Step Mode from the Debug menu. Of course, there’s more than one way to accomplish this goal, but keeping up with your variables as you step through the code can be invaluable. While doing so, you have an opportunity to discern the value of variables and properties. Pressing lets you step through the current procedure line by line so you can watch the code execute. It’s a good way to discern that a value isn’t what you expected so you can take corrective action. Keep in mind that the Debug.Print only prints values to the Immediate window so that you can easily view them.
![microsoft visual basic for applications view variabes debug microsoft visual basic for applications view variabes debug](https://community.intersystems.com/sites/default/files/inline/images/untitled_3.png)
That way, you can see the evaluated line in the Immediate window, as shown in Figure A, where mistakes are much easier to spot. (Well… most of us can’t.) When you need to concatenate strings to create a SQL statement, connection string, and so on, assign the evaluated string to a variable and then insert a Debug.Print statement immediately following the definition statement.
![microsoft visual basic for applications view variabes debug microsoft visual basic for applications view variabes debug](https://codedocu.com/Daten/Images/2/Image_1680_1.jpg)
That’s because the hoops you jump through to concatenate the pieces aren’t intuitive - you can’t just look at the statement and see that you’re missing a space, a quotation mark, and so on. 1: View evaluated strings in the Immediate windowįew debugging chores are more frustrating than debugging an evaluated string. The following tips for debugging go a step beyond using the tools and offer recommendations for making the process smoother and more efficient. Fortunately, the Visual Basic Editor provides a number of helpful tools for debugging your VBA code. Susan Harkins suggests a few ways to streamline your debugging tasks.ĭebugging your code lets you find and resolve errors before your users run into them. The VBE provides tools to help you debug your code, but you need to know a few tricks to use them effectively. Five tips for debugging a routine in the Visual Basic Editor