- Microsoft visual basic for applications view variabes debug code#
- Microsoft visual basic for applications view variabes debug windows#
The values of such things as command button and label captions, textbox text, etc. The same thing can be accomplished by typing print intMyInt. For example, if you have a Private intMyInt As Integer statement you can see what the value of intMyInt is by typing ?intMyInt in the Immediate Window and pressing return. While you are in break mode you can display the values of the global variables in your form. When you click the command button, the Debug.Print statements will cause the value of lngCounter * 20 to be printed to the Immediate Window so if you then click the Immediate Window button you will see the following. Private Sub Command1_Click() Dim lngCounter As Long For lngCounter = 1 To 3 Debug.Print lngCounter * 20 Next End Sub
Microsoft visual basic for applications view variabes debug code#
There are at least four very useful things that you can do with the Immediate Window.ġ) Display the results of Debug.Print statementsĪs an example let's assume you have the following code in your command button.
Microsoft visual basic for applications view variabes debug windows#
The other two windows (which I'll discuss later) are the Watch window and the Locals window. The Immediate Window is one of three debugging windows that allow you to monitor the values of expressions and variables while stepping through the statements in your application. The breaking/changing code/continuing/testing code cycle can, of course, be repeated as many times as needed.Īvailability: At all times but it is read-only at run time Pressing the Continue button takes you back to Run mode where you can now click the command button to see the effect of your change. At this point, you can do things like adding or changing code in the Click event of a command button. Pressing the button also has the effect of enabling the Start button and toggling it to Continue. Once your program has started, and, for example, the main form has loaded and it is ready for interaction with the user, pressing the Break button pauses the execution of the program and takes you to the edit window for the form. (I've changed the order a bit.)Īvailability: Design time and when in break modeĬlicking Start not surprisingly starts your program running just likes F5 does. The following is an explanation of what each button does. If you can't find that toolbar then you can add it to the menus by pulling down the View menu item, clicking Toolbars, and checking Debug. There is also a companion Debug Toolbar that looks like the following and that toolbar will be the focus of this tutorial: That menu item can normally be found in the IDE's main menu line as shown in this picture. The debugging module can be accessed by way of the Debug menu item.