Tiny VBA Tooltippery Tip

Project Euler 100/304

(in which we discover What Went On In 1997)

This morning’s iteration of the daily blog/news trawl for useful information threw up “Five tips for debugging a routine in the Visual Basic Editor“, all of which are sensible, although unlikely to be news to anyone reading this, if we’re honest.

Tip #3, “View variables using data tips”, however, reminded me of something that I don’t believe is widely known. Since the site seems to require a full-blown account creation that I can’t see as appropriate for a simple comment, I’m going to mention it here.

Hovering the mouse pointer over a variable while in VBA’s Break mode will show the variable’s value in a tool tip:

The smart VBA programmer

That’s fine: almost all the time we get to see exactly what we want. Above about (or maybe exactly) 60 characters, however, we get the leading part and three little dots:

Still no problem if we only want the start of the string...

What if we want to see what’s at the end of the string, though? Well, back in (I think) 1997, I managed to get my then employer to send me to VBA DevCon (no easy task, given that the location was EuroDisney), at which I happened to meet the Microsoft guy who actually wrote the hover/tooltip thing (it was in the VB4 editor first, I believe) and he told me that viewing the last 60-ish characters of the string could be achieved by holding down the Control key before moving the pointer over the variable name:

Presto!

I don’t think I’ve ever seen this recorded. Of course, I haven’t exactly gone looking for it, so if you came all the way to the end only to discover that I was just repeating something that everyone knows, then I can only apologise. We’ll get over it.

Advertisements

5 Responses to Tiny VBA Tooltippery Tip

  1. ross says:

    Brilliant I did not know that. Can’t imagine that I will use it much though! ;-), but good to know.

    The other one that a lot of VBA devs dont know, although people reading this blog post probably will, is that you can drag the brake point (well the yellow arrow) back up the code, very useful, slightly dangerous.

    Why is you code pane dark grey Mike?

    Ross

  2. Dr Loser says:

    Oh, I don’t know. I can definitely see you at EuroDisney, Mike. Big floppy ears and a wet nose and all … it’d certainly keep your kids entertained.

    That VBA tip looks fairly obvious to me (although you’re right; I don’t think it’s ever been explained on a Webtastic site). I think it applies across the board to all MS products (including VS, obv), but I’m too lazy to check. The great thing about using MS stuff is that you think “this is insane … there must be some way of doing it,” and then you experiment with the obvious keyboard possibilities — adding a little undo here, a little redo there … and you finally figure it out.

    I think the approbation I’m looking for is “consistency.”

  3. Pingback: Tool-tip tip | Newton Excel Bach, not (just) an Excel Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: