View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] james.billy@gmail.com is offline
external usenet poster
 
Posts: 69
Default capturing the values from a combo box into an xml file

On Aug 15, 7:16*am, DowningDevelopments
wrote:
iv got a simple multi select combo box which takes the values from a range of
cells (its a concept design im trying to show that this works).

That part works, what i need to do is capture those values and then put them
into an xml file which we can ADO into a database.

im stuck on actually grabbing the values from the comboBox, how do i access
the array its storing them in, i can write a while look and go through it but
i dont know how to access the data.

any help?

Amit


I assume you mean Listbox rather than combo box (as far as I know you
can't have a multiselect combo box in vba)

Is the control on a form or a worksheet, if its on a form you would
use something like the following attached to a command button so once
the user has finished selecting you can add to the xml sheet:

For i = 0 To Me.ListBox1.ListCount - 1 ' listboxes are zero based
If Me.ListBox1.Selected(i) Then ' if the item is selected then
tmpStr = tmpStr & vbCr & Me.ListBox1.List(i, 0)
End If
Next i
MsgBox tmpStr

James