In this video I talk about VBA Debug aspects like the Immediate Window, Local Window and Watch Window.
…also we use the “debug.print” statement to print a value to the Immediate window.
The Local Window is useful to view the current state of all the variables present in the current sub procedure.
The Watch Window is useful on long running processes that you don’t want to step through line by line. In the example we want to “watch” and set a breakpoint when a variable’s value becomes 20. We don’t want to set a breakpoint and step through each time the variable changes, 100 times, so a breakpoint would be too time consuming.
Private Sub watch() Dim x As Integer Do Until x = 100 Debug.Print x x = x + 1 Loop End Sub
<< VBA Debug Part 1 | VBA Error Handling PT1 >>
Click here for VBA debugging related posts.
How To Parse A Flat File In Excel VBA
In another post I demonstrated how to access a file on your computer using the MS Office Library. Here it is if you don’t know what I’m talking about. In this post, I am going to show you how to access the file and load it into your spreadsheet. I will do the same thing […]
How can I interact with other Office applications (Excel) using VBA in Access?
Need to write your Access data or query to an Excel file? Here is the how to do it: Most people are familiar with Excel and know how to use it well (enough), and when you start talking about Access, they get scared off, and don’t know what to do anymore. Well, here you are […]
How To Generate A XML File With Access VBA
XML is used to structure your data. You can send a CSV file to another person, but using XML, you can structure your data in a more elegant format, and get very specific about your fields, and what data is contained within your tags (your field names). This is different than a basic CSV file […]
Find Error Line Number in VBA With Erl
In this post you are going to find out a way of handling errors in your code with the Erl function. Erl displays the last label before the error Another alternative error handling solution is using labels at each point in long procedure. Here we get a random error: Here is the code behind the […]