Microsoft Office Tutorials and References
In Depth Information
? TypeName(Counter)
If you discover that Counter is of a data type other than Integer or Long, you may have solved your problem.
You can execute multiple statements in the Immediate window if you separate them with a colon. This line con-
tains three statements:
x=12: y=13 : ? x+y
Most, but not all, statements can be executed in this way.
Setting a breakpoint in the function
Another debugging technique is to set a breakpoint in your code. Execution pauses when VBA encounters a
breakpoint. You can then use the Immediate window to check the values of your variables, or you can use F8 to
step through your code line by line.
To set a breakpoint, move the cursor to the statement at which you want to pause execution and choose De-
bug Toggle Breakpoint. Alternatively, you can press F9 or you can click the vertical bar to the left of the code
window. Any of these actions highlights the statement to remind you that a breakpoint is in effect (you also see
a dot in the code window margin). You can set any number of breakpoints in your code. To remove a break-
point, move the cursor to the statement and press F9. Figure 24-10 shows a Function procedure that contains a
breakpoint.
Figure 24-10: The highlighted statement contains a breakpoint.
To remove all breakpoints in all open projects, choose Debug Clear All Breakpoints or
press Control+Shift+F9.
Search JabSto ::




Custom Search