VBA Hover ToolTip Trick

I’m pretty busy today so here’s a quick VBA tip.

We all know if you hover over a variable in VBA (while in debug mode) you can see the value of that variable.  This allows you to see the values that are being passed in and out of variables – very useful.  But by my estimation, these tooltips can only hold 77 characters (including the variable name).  This basically means if the value in your variable is too long, it gets cut off.


Here’s an example.  Hovering over the variable TempDataFile allows me to see the string that represents the file name, but that string gets cut off.




Although there is no way to tell Excel to show more than the first 77 characters, there is a trick you can use to see then last 77 characters.

Simply hold down the CTRL key while you hover.  As you can see, this allows me to see the last part of the file name.vbahover2

7 thoughts on “VBA Hover ToolTip Trick

  1. Rick Rothstein (MVP - Excel)

    Well, there is a new one on me. Up until now, I have always been executing (using your example variable name) a “?TempDataFile” statement in the Immediate Window. Thanks for posting this tip!

  2. Rick Rothstein (MVP - Excel)

    Interesting… and surprising… this trick also works in the compiled version of VB6. I was a VB MVP before becoming an Excel MVP… I used (and still do occasionally) the compiled version of VB6 for some 10 years now and I never have seen this trick before now. I wonder if it has always been available in the various versions of VB?

  3. Paul Rohorzka

    Thank you for that interesting hint, that was new to me as well.
    Unfortunately, I discovered that even with the Ctrl key pressed, the tooltip just shows the text up to the 250th character of the string without appending an ellipsis at the end (O2k3).
    Thus, we still have to be cautious when debugging code with big strings.

    P.S.: I’m also curious how you discovered that! 🙂

  4. Happy Customer

    Nice tip, thanks! I also used the debug.print [variable name] method. This saves time!!

Leave a Reply

Your email address will not be published. Required fields are marked *