Get list box top entry / scroll the list box with VBA (1 Viewer)

yamus

Member
Local time
Today, 13:06
Joined
Aug 12, 2020
Messages
81
Hello
1# I was looking for a method to get the top entry of list box programmatically with vba.
2# Is there a way to scroll the list box with VBA?
Thanks in advance

EDIT:
I did not explain well my first request.
I want to be able to select which item to be displayed as the list box to entry.
 
Last edited:

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:06
Joined
Aug 30, 2003
Messages
36,125
This should return the first item:

forms!FormName.ListboxName.itemdata(0)

You can certainly loop the listbox. What are you trying to achieve?
 

yamus

Member
Local time
Today, 13:06
Joined
Aug 12, 2020
Messages
81
This should return the first item:

forms!FormName.ListboxName.itemdata(0)

You can certainly loop the listbox. What are you trying to achieve?
i want to choose the top entry position or to scoll the list box programmatically with VBA not with the mouse
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 05:06
Joined
Aug 30, 2003
Messages
36,125
Well, the code given will let you choose the first item:

Me.List20 = Me.List20.ItemData(0)

I'm not sure how to scroll the listbox other than by clicking on the scroll bar, perhaps someone else does.
 

Users who are viewing this thread

Top Bottom