VBA: How to deselect/unhighlight form listbox item

  • Thread starter Thread starter Dave Jenkins
  • Start date Start date
D

Dave Jenkins

Office 2007 SP 1, Windows XP SP3

I am trying to put up a listbox defined in a user form, from which a user
can select one of the lines by single-clicking. When they do that, I want to
put up a message box containing some information about that line. When they
click OK on the MSGBOX, they can click on another listbox item and display
info about *that* item.

That all works ok, but here's what doesn't: When they click the *second*
item, I'd like to remove the highlighting on the first item they selected
before I put up the MSGBOX. As it stands now, when the second MSGBOX gets
displayed, both the first and second lines are highlighted.

Go here: http://www.mediafire.com/?yvqrit3zgem to download a very simple
file which will demonstrate what I'm talking about -- just run the macro
cleverly called "test."

I have tried all sorts of .deselect shenanigans, .repaints, modeless/modal
and other whathaveyou, but nothing seems to work.

It's probably very simple, but I just can't dope it out.

Thanks.
 
Thanks, Steve.

That's what tunnel vision will get ya - I was so fixated on using the MSGBOX
that I never thought of putting it on the form itself.

I'll head down that path.

I'm glad, though, that you could reproduce the same behavior. This thing
about drove me nuts this afternoon. (It's not a long trip ...)

Dave
 
Back
Top