Avatar of FaheemAhmadGul
FaheemAhmadGul
Flag for United Kingdom of Great Britain and Northern Ireland asked on

VBA ListBox - get the value of the selected item and dislay it in a message box

I am displaying a few strings items on ListBox on a Form. I would like to display the value of the item (which is a string) displayed in a message box when I click on it. I would appreciate your help.
Microsoft OfficeVBAMicrosoft Word

Avatar of undefined
Last Comment
FaheemAhmadGul

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Norie

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
FaheemAhmadGul

ASKER
Thank you for your comment. This does not work, however. We need the value of the selected item and not of the ListBox - that is we want to display the value of the item on which the user clicks. This will involve finding out which item the user clicked on and then fidning its value.
Norie

That code should show you the item that's been clicked in the listbox because Value returns the value of the selected item in the listbox.
SOLUTION
GrahamSkan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
FaheemAhmadGul

ASKER
Many thanks. Actually both the solutions work. I have split the points - more points to Norie because that solution was post first. Hope this OK.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy