Loop thru Listbox not getting all records
I trying to loop through a listbox and retrieve e-mail addresses. I get the addresses just fine what I’m having a problem with is. If there are ten addresses I’m only pulling 9 addresses and if there is only one address it does not do anything.
What am I doing wrong?
VB Code:
Dim n As Integer
Dim x As Integer
'On Error GoTo err:
n = 0
x = lstSelected.ListCount - 1
Do Until n = x
lstSelected.ListIndex = n
adNM = InStr(1, lstSelected.Text, " - ")
adID = Right$(lstSelected.Text, Len(lstSelected.Text) - adNM - 1)
Addstr = adID
MsgBox adID
'Call SendBroadcast
n = n + 1
Loop