Getting value in dropdown list while 'hovering'

E

Ed

I have a combo box on a form. It is fairly narrow box, and frquently not all
of the text of a particular entry is visible. (It shows 15 or so characters,
generally enough for me to figuer out what the entry is, but not always.) I
cannot widen the box. (at least from a practical point of view).

When I move my cursor up and down the list of entries (without clicking
anything) the entry over which the cursor is hovering turns 'blue.' That
suggests that Word (VBA) 'knows' where it is (even without a mouse click). I
don't want to click anything at this point. I just want to hover and have
VBA help me to decide if that is the proper item, and if not, to the cursor
move up or down to the next item.

How can I capture that value (without clicking anything) and show it as a
controltiptext so that I can see the entire value of the entry? (I tried
playing with 'CurLine', but that doesn't work for lists, only textboxes).
Seems this should be easy, but I have been playing with this for hours with
0 success. I hope this group can help. Thanks.

Ed
 
V

Vince

Ed said:
I have a combo box on a form. It is fairly narrow box, and frquently not
all
of the text of a particular entry is visible. (It shows 15 or so
characters,
generally enough for me to figuer out what the entry is, but not always.)
I
cannot widen the box. (at least from a practical point of view).

When I move my cursor up and down the list of entries (without clicking
anything) the entry over which the cursor is hovering turns 'blue.' That
suggests that Word (VBA) 'knows' where it is (even without a mouse click).
I
don't want to click anything at this point. I just want to hover and have
VBA help me to decide if that is the proper item, and if not, to the
cursor
move up or down to the next item.


There is a hover property or something similar in VB that does that but I
can't seem to produce the same effect in VBA. I can't find the property
(Word 2000). Anyway, from my VB knowledge, provided the thing turns blue,
all you need to do is a:

for i=0 to list1.listitems.count-1
if list1(i).selected=true then
list1.tooltiptext="Selected " & list1(i)
end if
next

Whenever you see the blue thing, the list item has already been selected.

I am not a 100% sure about any of this but I guess this should do it....
 
E

Ed

There is a hover property or something similar in VB
that does that but I can't seem to produce the same
effect in VBA. I can't find the property
(Word 2000). Anyway, from my VB knowledge,
provided the thing turns blue, all you need to do is a:
for i=0 to list1.listitems.count-1
if list1(i).selected=true then
list1.tooltiptext="Selected " & list1(i)
end if
next
Whenever you see the blue thing, the list item has
already been selected.

Vince,

Unfortunately (for me) a combobox does not allow the "Selected" method
(or is it a property). Regardless, it zoos out when I try the code, or
anything like it. I'll keep looking. Thanks anyway.

Ed
 
V

Vince

Oops, I am sorry! I read Listbox!!! I am not sure why my eyes changed "Combo"
to "List!"
 
R

RoyL

Just wanted to let everyone know that this discussion is still 'open' and any
suggestions will be gratefully accepted. -Ed
 
D

David Sisson

This was the only thing I could make work. Well sort of... ;P

Private Sub ComboBox1_Change()
A = ComboBox1.ListIndex

Select Case A
Case 0
ComboBox1.ControlTipText = "Choosing 1 will give you Option A"

Case 1
ComboBox1.ControlTipText = "Choosing 2 will give you Option B"

Case 2
ComboBox1.ControlTipText = "Choosing 3 will give you Option C"

Case 3
ComboBox1.ControlTipText = "Choosing 4 will give you Option D"

Case 4
ComboBox1.ControlTipText = "Choosing 5 will give you Option E"

Case 5
ComboBox1.ControlTipText = "Choosing 6 will give you Option F"

End Select

End Sub

But this only works AFTER you click the selection, which is what you
didn't want. Also, you have to move the pointer off the combobox and
then back over before the control tip would display.

Another option would be to do just that, add another option. Add a Help
item in your list that would always stay at the top of the list for you
to select. That selection would bring up another userform that has a
widescreen version of your list.
 
N

NoDakDame Kathy

Hi Ed,

I played with some programming options and then I found the simplest answer
of all. The width of the box does not limit the width of the drop down list.
I created a combo box that where the width was 54 but I changed the value for
the ListWidth property to 144. When the form runs, the combo box is quite
narrow but when you click the down arrow, the list is much wider and I can
see all of my entries in their entirety. Give it a try and hopefully this
does what you need.

Kathy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top