getting value from listbox

  • Thread starter Thread starter Deb
  • Start date Start date
D

Deb

I have a custom field on a custom form. The custom field
is a listbox (multiselect), with possible values bound to
a keywords object. I need to extract the selected values
in VBA to export to Excel. I can't find the property with
the selected values. How to I do this?
Thanks
 
Hi Deb,

You will need to iterate through the Items in the listbox
(each will be a ListItem) and ask it if it is selected.
Then consume the value for each selected one. The code
would look like this:

Dim li as ListItem
Dim values as New Collection()

For Each li in myListBox.Items
If li.Selected Then
values.Add(li.Value)
End If
Next

HTH,

Chris
 
Back
Top