While debugging code in the Visual Basic Editor (VBE) , you can see the values of variables and expressions using the Quick Watch feature. Select the variable or expression whose value you want to see and press Shift+F9 to view the Quick Watch dialog.

You can also hover over most variables and expressions to show a tooltip with the value. These are valuable techniques, particularly when you want to see only part a formula. The first example shows the Quick Watch dialog and the second shows the tooltip, both showing the results of part a formula. Note that A1 holds the value 10.



Posted in Uncategorized

4 thoughts on “QuickWatch

  1. When hovering over a variable with a lot of content you can use the CTRL key to truncate the front of the variable.

    Try stepping thru this simple routine and once strTemp has been loaded hover the mouse over it. The ZZZ’s will be truncated.
    Now hold the CTRL key and hover, you should now see ZZZ’s and AAA’s will be truncated.

    Sub x()

    Dim strTemp As String

    strTemp = “AAA” & String(150, “o”) & “ZZZ”

    End Sub

    And Dick have yourself a happy thanksgiving!

  2. Thanks for the holiday greetings, Andy. That CTRL thing is new to me, very cool. I could actually see the WHERE clause in an SQL string or the file name in a really long path without using the Immediate Window.

Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.